Parent

Included Modules

Diff::LCS::Change

Represents a simplistic (non-contextual) change. Represents the removal or addition of an element from either the old or the new sequenced enumerable.

Attributes

action[R]

Returns the action this Change represents. Can be '+' (adding?), '-' (deleting?), '=' (unchanged?), # or '!' (changed?). When created by Diff::LCS#diff or Diff::LCS#sdiff, it may also be '>' (finished_a?) or '<' (finished_b?).

element[R]
position[R]

Public Class Methods

from_a(arr) click to toggle source
# File lib/diff/lcs/change.rb, line 81
def self.from_a(arr)
  Diff::LCS::Change.new(arr[0], arr[1], arr[2])
end
new(action, position, element) click to toggle source
# File lib/diff/lcs/change.rb, line 70
def initialize(action, position, element)
  @action = action
  @position = position
  @element = element
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/diff/lcs/change.rb, line 63
def <=>(other)
  r = self.action <=> other.action
  r = self.position <=> other.position if r.zero?
  r = self.element <=> other.element if r.zero?
  r
end
==(other) click to toggle source
# File lib/diff/lcs/change.rb, line 57
def ==(other)
  (self.action == other.action) and
  (self.position == other.position) and
  (self.element == other.element)
end
to_a() click to toggle source

Creates a Change from an array produced by Change#to_a.

# File lib/diff/lcs/change.rb, line 77
def to_a
  [@action, @position, @element]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.