Represents a simplistic (non-contextual) change. Represents the removal or addition of an element from either the old or the new sequenced enumerable.
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?).
# File lib/diff/lcs/change.rb, line 81 def self.from_a(arr) Diff::LCS::Change.new(arr[0], arr[1], arr[2]) end
# File lib/diff/lcs/change.rb, line 70 def initialize(action, position, element) @action = action @position = position @element = element end
# 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
# 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