Class: Delta
- Inherits:
-
Object
show all
- Defined in:
- lib/delta/base.rb,
lib/delta/plucker.rb,
lib/delta/identifier.rb,
lib/delta/set_operator.rb,
lib/delta/set_operator/enumerable.rb,
lib/delta/set_operator/active_record.rb
Defined Under Namespace
Classes: Identifier, Plucker, SetOperator
Instance Method Summary
collapse
Constructor Details
#initialize(from:, to:, pluck: nil, keys: nil) ⇒ Delta
Returns a new instance of Delta.
Instance Method Details
#additions ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/delta/base.rb', line 8
def additions
Enumerator.new do |y|
set.subtract_a_from_b.each do |b|
y.yield plucker.pluck(b)
end
end
end
|
#deletions ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/delta/base.rb', line 27
def deletions
Enumerator.new do |y|
set.subtract_b_from_a.each do |a|
y.yield plucker.pluck(a)
end
end
end
|
#modifications ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/delta/base.rb', line 16
def modifications
Enumerator.new do |y|
set.intersection.each do |a, b|
a_attributes = plucker.pluck(a)
b_attributes = plucker.pluck(b)
y.yield b_attributes unless a_attributes == b_attributes
end
end
end
|