Class: SuperDiff::OperationTreeBuilders::Array::LcsCallbacks

Inherits:
Object
  • Object
show all
Defined in:
lib/super_diff/operation_tree_builders/array.rb

Instance Method Summary collapse

Instance Method Details

#change(event) ⇒ Object



47
48
49
50
51
52
53
54
55
56
# File 'lib/super_diff/operation_tree_builders/array.rb', line 47

def change(event)
  children = compare.(event.old_element, event.new_element)

  if children
    add_change_operation(event, children)
  else
    add_delete_operation(event)
    add_insert_operation(event)
  end
end

#discard_a(event) ⇒ Object



39
40
41
# File 'lib/super_diff/operation_tree_builders/array.rb', line 39

def discard_a(event)
  add_delete_operation(event)
end

#discard_b(event) ⇒ Object



43
44
45
# File 'lib/super_diff/operation_tree_builders/array.rb', line 43

def discard_b(event)
  add_insert_operation(event)
end

#match(event) ⇒ Object



35
36
37
# File 'lib/super_diff/operation_tree_builders/array.rb', line 35

def match(event)
  add_noop_operation(event)
end