Class: TreeDelta

Inherits:
Enumerator
  • Object
show all
Defined in:
lib/tree_delta/base.rb

Defined Under Namespace

Modules: Normaliser, Sorter Classes: Intermediate, Operation, Traversal

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from:, to:) ⇒ TreeDelta

Returns a new instance of TreeDelta.



5
6
7
# File 'lib/tree_delta/base.rb', line 5

def initialize(from:, to:)
  @from, @to = from, to
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



3
4
5
# File 'lib/tree_delta/base.rb', line 3

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



3
4
5
# File 'lib/tree_delta/base.rb', line 3

def to
  @to
end

Instance Method Details

#each(&block) ⇒ Object



9
10
11
12
13
# File 'lib/tree_delta/base.rb', line 9

def each(&block)
  deletes_and_detaches.each { |o| yield o }
  creates_and_attaches.each { |o| yield o }
  updates.each              { |o| yield o }
end