Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49a1d8f

Browse files
author
Leo Silva Souza
committed
fail if no arg
1 parent 1cbc201 commit 49a1d8f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

2018/07_2/ruby/leovano.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22

3+
raise "Arg1" if ARGV[0].nil?
34
input = File.readlines(ARGV[0])
45

56
RULE = /^Step ([a-zA-Z]+) .* step ([a-zA-Z]+) can begin.$/.freeze
@@ -33,7 +34,7 @@
3334
workers.map! { |worker, secs| [worker, secs - min] }
3435

3536
workers.select { |it| it[1].zero? }.each do |worker|
36-
workers.slice!(workers.index(worker))
37+
workers.slice! workers.index worker
3738
steps_done << worker[0]
3839
steps_current += dependents[worker[0]]
3940
end

0 commit comments

Comments
 (0)