Class: Lorax::DeltaSet

Inherits:
Object
  • Object
show all
Defined in:
lib/lorax/delta_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDeltaSet

Returns a new instance of DeltaSet.



5
6
7
# File 'lib/lorax/delta_set.rb', line 5

def initialize
  @deltas = []
end

Instance Attribute Details

#deltasObject

Returns the value of attribute deltas.



3
4
5
# File 'lib/lorax/delta_set.rb', line 3

def deltas
  @deltas
end

Instance Method Details

#add(delta) ⇒ Object



9
10
11
# File 'lib/lorax/delta_set.rb', line 9

def add(delta)
  @deltas << delta
end

#apply(document) ⇒ Object



13
14
15
# File 'lib/lorax/delta_set.rb', line 13

def apply(document)
  apply! document.dup
end

#apply!(document) ⇒ Object



17
18
19
20
21
22
# File 'lib/lorax/delta_set.rb', line 17

def apply!(document)
  deltas.each do |delta|
    delta.apply! document
  end
  document
end