Class: Test::Unit::Diff::ReadableDiffer

Inherits:
Differ
  • Object
show all
Defined in:
lib/test/unit/diff.rb

Direct Known Subclasses

UI::Console::ColorizedReadableDiffer

Instance Method Summary collapse

Methods inherited from Differ

#initialize

Constructor Details

This class inherits a constructor from Test::Unit::Diff::Differ

Instance Method Details

#diff(options = {}) ⇒ Object



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/test/unit/diff.rb', line 413

def diff(options={})
  @result = []
  operations.each do |tag, from_start, from_end, to_start, to_end|
    case tag
    when :replace
      diff_lines(from_start, from_end, to_start, to_end)
    when :delete
      tag_deleted(@from[from_start...from_end])
    when :insert
      tag_inserted(@to[to_start...to_end])
    when :equal
      tag_equal(@from[from_start...from_end])
    else
      raise "unknown tag: #{tag}"
    end
  end
  @result
end