Class: XmlPatch::DiffBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/xml_patch/diff_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDiffBuilder

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_documentObject (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