Class: Lookout::Diff::Operations::Equal

Inherits:
Object
  • Object
show all
Includes:
Lookout::Diff::Operation
Defined in:
lib/lookout/diff/operations/equal.rb

Instance Attribute Summary

Attributes included from Lookout::Diff::Operation

#from, #to

Instance Method Summary collapse

Methods included from Lookout::Diff::Operation

#==, #initialize, #inspect

Instance Method Details

#<<(size) ⇒ Object



15
16
17
18
# File 'lib/lookout/diff/operations/equal.rb', line 15

def <<(size)
  self.class.new(from.end_at([from.end, from.begin + size - 1].min),
                 to.end_at([to.end, to.begin + size - 1].min))
end

#>>(size) ⇒ Object



10
11
12
13
# File 'lib/lookout/diff/operations/equal.rb', line 10

def >>(size)
  self.class.new(from.begin_at([from.begin, from.end - size + 1].max),
                 to.begin_at([to.begin, to.end - size + 1].max))
end

#apply(object) ⇒ Object



24
25
26
# File 'lib/lookout/diff/operations/equal.rb', line 24

def apply(object)
  object.equal(self)
end

#foldable?(window) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/lookout/diff/operations/equal.rb', line 6

def foldable?(window)
  from.size > window
end

#parity?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/lookout/diff/operations/equal.rb', line 20

def parity?
  from == to
end