diff --git a/2017/ruby/day_07.rb b/2017/ruby/day_07.rb index b28de74..3e4eb3b 100644 --- a/2017/ruby/day_07.rb +++ b/2017/ruby/day_07.rb @@ -1,7 +1,7 @@ Program = Struct.new(:name, :weight, :disc) programs = {} -File.read(File.expand_path("../input/day_07.txt")).strip.split("\n").each do |line| +ARGF.read.strip.split("\n").each do |line| name, weight, above = line.scan(/(.+) \((\d+)\)(?: -> (.+))?/)[0] programs[name] = Program.new(name, weight.to_i, (above || "").split(", ")) end