Class: Lorax::DeltaSet
- Inherits:
-
Object
- Object
- Lorax::DeltaSet
- Defined in:
- lib/lorax/delta_set.rb
Instance Attribute Summary collapse
-
#deltas ⇒ Object
Returns the value of attribute deltas.
Instance Method Summary collapse
- #add(delta) ⇒ Object
- #apply(document) ⇒ Object
- #apply!(document) ⇒ Object
-
#initialize ⇒ DeltaSet
constructor
A new instance of DeltaSet.
Constructor Details
#initialize ⇒ DeltaSet
Returns a new instance of DeltaSet.
5 6 7 |
# File 'lib/lorax/delta_set.rb', line 5 def initialize @deltas = [] end |
Instance Attribute Details
#deltas ⇒ Object
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 |