Class: XmlPatch::DiffBuilder
- Inherits:
-
Object
- Object
- XmlPatch::DiffBuilder
- Defined in:
- lib/xml_patch/diff_builder.rb
Instance Attribute Summary collapse
-
#diff_document ⇒ Object
readonly
Returns the value of attribute diff_document.
Instance Method Summary collapse
-
#initialize ⇒ DiffBuilder
constructor
A new instance of DiffBuilder.
- #parse(xml) ⇒ Object
- #remove(xpath) ⇒ Object
Constructor Details
#initialize ⇒ DiffBuilder
Returns a new instance of DiffBuilder.
9 10 11 |
# File 'lib/xml_patch/diff_builder.rb', line 9 def initialize @diff_document = XmlPatch::DiffDocument.new end |
Instance Attribute Details
#diff_document ⇒ Object (readonly)
Returns the value of attribute diff_document.
7 8 9 |
# File 'lib/xml_patch/diff_builder.rb', line 7 def diff_document @diff_document end |
Instance Method Details
#parse(xml) ⇒ Object
17 18 19 20 21 |
# File 'lib/xml_patch/diff_builder.rb', line 17 def parse(xml) handler = SaxHandler.new(self) Oga.sax_parse_xml(handler, xml) self end |
#remove(xpath) ⇒ Object
13 14 15 |
# File 'lib/xml_patch/diff_builder.rb', line 13 def remove(xpath) diff_document << XmlPatch::Operations::Remove.new(sel: xpath) end |