[2017][ruby][7.x] move back to ARGF

sorbet
Alpha Chen 7 years ago
parent 1516d44017
commit d447e45d11

@ -1,7 +1,7 @@
Program = Struct.new(:name, :weight, :disc) Program = Struct.new(:name, :weight, :disc)
programs = {} 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] name, weight, above = line.scan(/(.+) \((\d+)\)(?: -> (.+))?/)[0]
programs[name] = Program.new(name, weight.to_i, (above || "").split(", ")) programs[name] = Program.new(name, weight.to_i, (above || "").split(", "))
end end

Loading…
Cancel
Save