Class: Lookout::Diff::Match
Overview
Matching pair of Slices of the sequences being “diffed”.
Instance Method Summary collapse
-
#+(other) ⇒ Object
A new match encompassing the slices of the receiver and OTHER.
-
#at(old, new) ⇒ Match
A new match with #old and #new #at OLD and NEW.
-
#empty? ⇒ Boolean
True if the matching sequences are empty.
-
#size ⇒ Object
The number of matching elements.
-
#touch?(other) ⇒ Boolean
True if #old and #new #touch? those of OTHER.
Instance Method Details
#+(other) ⇒ Object
Note:
Logically, the receiver should #touch? OTHER, but this isn’t enforced.
Returns A new match encompassing the slices of the receiver and OTHER.
21 |
# File 'lib/lookout-3.0/diff/match.rb', line 21 def +(other) self.class.new(old + other.old, new + other.new) end |
#at(old, new) ⇒ Match
Returns A new match with #old and #new #at OLD and NEW.
30 |
# File 'lib/lookout-3.0/diff/match.rb', line 30 def at(old, new) self.class.new(self.old.at(old), self.new.at(new)) end |
#empty? ⇒ Boolean
Returns True if the matching sequences are empty.
12 |
# File 'lib/lookout-3.0/diff/match.rb', line 12 def empty?; old.empty? end |
#size ⇒ Object
Returns The number of matching elements.
15 |
# File 'lib/lookout-3.0/diff/match.rb', line 15 def size; old.size end |
#touch?(other) ⇒ Boolean
Returns True if #old and #new #touch? those of OTHER.
24 |
# File 'lib/lookout-3.0/diff/match.rb', line 24 def touch?(other) old.touch? other.old and new.touch? other.new end |