Class: Lorax::DeleteDelta
- Defined in:
- lib/lorax/delta/delete_delta.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
Returns the value of attribute node.
Instance Method Summary collapse
- #apply!(document) ⇒ Object
- #descriptor ⇒ Object
-
#initialize(node) ⇒ DeleteDelta
constructor
A new instance of DeleteDelta.
Methods inherited from Delta
Constructor Details
#initialize(node) ⇒ DeleteDelta
Returns a new instance of DeleteDelta.
5 6 7 |
# File 'lib/lorax/delta/delete_delta.rb', line 5 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object
Returns the value of attribute node.
3 4 5 |
# File 'lib/lorax/delta/delete_delta.rb', line 3 def node @node end |
Instance Method Details
#apply!(document) ⇒ Object
9 10 11 12 13 |
# File 'lib/lorax/delta/delete_delta.rb', line 9 def apply!(document) target = document.at_xpath(node.path) raise NodeNotFoundError, xpath unless target target.unlink end |
#descriptor ⇒ Object
15 16 17 |
# File 'lib/lorax/delta/delete_delta.rb', line 15 def descriptor [:delete, {:xpath => node.path, :content => node.to_s}] end |