Class: SuperDiff::Basic::OperationTreeBuilders::Hash::LCSCallbacks
- Inherits:
-
Object
- Object
- SuperDiff::Basic::OperationTreeBuilders::Hash::LCSCallbacks
- Defined in:
- lib/super_diff/basic/operation_tree_builders/hash.rb
Instance Method Summary collapse
Instance Method Details
#discard_a(event) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/super_diff/basic/operation_tree_builders/hash.rb', line 45 def discard_a(event) # This key is in `expected`, but may also be in `actual`. key = event.old_element # We want the diff to match the key order of `actual` as much as # possible, so if this is also a key in `actual` that's just being # reordered, don't add any operations now. The change or noop will # be added later. return if actual.include?(key) operations << Core::UnaryOperation.new( name: :delete, collection: expected, key: key, value: expected[key], index: event.old_position ) end |
#discard_b(event) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/super_diff/basic/operation_tree_builders/hash.rb', line 64 def discard_b(event) # This key is in `actual`, but may also be in `expected`. key = event.new_element handle_operation_on_key_in_actual(key, event) end |
#match(event) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/super_diff/basic/operation_tree_builders/hash.rb', line 71 def match(event) # This key is part of the longest common subsequence. key = event.old_element handle_operation_on_key_in_actual(key, event) end |