19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/super_diff/operational_sequencers/base.rb', line 19
def call
i = 0
operations = build_operation_sequencer
while i < unary_operations.length
operation = unary_operations[i]
next_operation = unary_operations[i + 1]
child_operations = possible_comparison_of(operation, next_operation)
if child_operations
operations << Operations::BinaryOperation.new(
name: :change,
left_collection: operation.collection,
right_collection: next_operation.collection,
left_key: operation.key,
right_key: operation.key,
left_value: operation.collection[operation.key],
right_value: next_operation.collection[operation.key],
left_index: operation.index,
right_index: operation.index,
child_operations: child_operations,
)
i += 2
else
operations << operation
i += 1
end
end
operations
end
|