Skip to content

Commit 684e862

Browse files
MrSerthDome-GER
authored andcommitted
Simplify Submission#command_for
The previous mechanism always cycled through all files once again, just to identify the very same file and using an attribute passed to the method. This can be simplified with the given refactoring.
1 parent ca39aa4 commit 684e862

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

app/models/submission.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,7 @@ def swap_runner(old_runner)
248248
[new_runner, new_waiting_duration]
249249
end
250250

251-
def command_for(template, file)
252-
filepath = collect_files.find {|f| f.filepath == file }.filepath
251+
def command_for(template, filepath)
253252
template % command_substitutions(filepath)
254253
end
255254

0 commit comments

Comments
 (0)