Class: Lookout::Diff::Match

Inherits:
Object show all
Defined in:
lib/lookout-3.0/diff/match.rb

Overview

Matching pair of Slices of the sequences being “diffed”.

Instance Method Summary collapse

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.

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.

Parameters:

Returns:

  • (Match)

    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.

Returns:

  • (Boolean)

    True if the matching sequences are empty



12
# File 'lib/lookout-3.0/diff/match.rb', line 12

def empty?; old.empty? end

#sizeObject

Returns The number of matching elements.

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.

Returns:

  • (Boolean)

    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