class Delta

Attributes

set[RW]

Public Class Methods

new(from:, to:, identifiers: nil, changes: []) click to toggle source
# File lib/delta/base.rb, line 2
def initialize(from:, to:, identifiers: nil, changes: [])
  self.set = SetOperator.adapt(
    a: from,
    b: to,
    identifiers: identifiers,
    changes: changes
  )
end

Public Instance Methods

additions() click to toggle source
# File lib/delta/base.rb, line 11
def additions
  Enumerator.new do |y|
    set.b_minus_a.each do |b|
      y.yield b
    end
  end
end
deletions() click to toggle source
# File lib/delta/base.rb, line 27
def deletions
  Enumerator.new do |y|
    set.a_minus_b.each do |a|
      y.yield a
    end
  end
end
modifications() click to toggle source
# File lib/delta/base.rb, line 19
def modifications
  Enumerator.new do |y|
    set.intersection.each do |b|
      y.yield b
    end
  end
end