Class: XmlPatch::Operations::Remove
- Inherits:
-
Object
- Object
- XmlPatch::Operations::Remove
- Defined in:
- lib/xml_patch/operations/remove.rb
Instance Attribute Summary collapse
-
#sel ⇒ Object
readonly
Returns the value of attribute sel.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #apply_to(doc) ⇒ Object
-
#initialize(sel:) ⇒ Remove
constructor
A new instance of Remove.
- #operation ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(sel:) ⇒ Remove
Returns a new instance of Remove.
6 7 8 |
# File 'lib/xml_patch/operations/remove.rb', line 6 def initialize(sel:) @sel = sel.dup.freeze end |
Instance Attribute Details
#sel ⇒ Object (readonly)
Returns the value of attribute sel.
4 5 6 |
# File 'lib/xml_patch/operations/remove.rb', line 4 def sel @sel end |
Instance Method Details
#==(other) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/xml_patch/operations/remove.rb', line 15 def ==(other) other.respond_to?(:operation) && other.operation == operation && other.respond_to?(:sel) && other.sel == sel end |
#apply_to(doc) ⇒ Object
10 11 12 13 |
# File 'lib/xml_patch/operations/remove.rb', line 10 def apply_to(doc) doc.remove_at!(sel) doc end |
#operation ⇒ Object
22 23 24 |
# File 'lib/xml_patch/operations/remove.rb', line 22 def operation :remove end |
#to_xml ⇒ Object
26 27 28 |
# File 'lib/xml_patch/operations/remove.rb', line 26 def to_xml %(<remove sel="#{sel}" />) end |