Class: DamageControl::DiffParser
- Inherits:
-
Object
- Object
- DamageControl::DiffParser
- Defined in:
- lib/damagecontrol/diff_parser.rb
Constant Summary collapse
- DIFF_START =
/@@ \-([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@/
Instance Method Summary collapse
Instance Method Details
#parse_diffs(io) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/damagecontrol/diff_parser.rb', line 7 def parse_diffs(io) diffs = [] diff = nil io.each_line do |line| if(line =~ DIFF_START) diffs << diff if diff diff = Diff.new($1.to_i, $2.to_i, $3.to_i, $4.to_i) elsif(diff) diff << line end end diffs << diff if diff diffs.each do |diff| diff.parse end diffs end |