Class: XmlPatch::Applicator
- Inherits:
-
Object
- Object
- XmlPatch::Applicator
- Defined in:
- lib/xml_patch/applicator.rb
Instance Attribute Summary collapse
-
#diff_xml ⇒ Object
readonly
Returns the value of attribute diff_xml.
Instance Method Summary collapse
-
#initialize(diff_xml) ⇒ Applicator
constructor
A new instance of Applicator.
- #to(target_xml) ⇒ Object
Constructor Details
#initialize(diff_xml) ⇒ Applicator
Returns a new instance of Applicator.
8 9 10 |
# File 'lib/xml_patch/applicator.rb', line 8 def initialize(diff_xml) @diff_xml = diff_xml.dup.freeze end |
Instance Attribute Details
#diff_xml ⇒ Object (readonly)
Returns the value of attribute diff_xml.
6 7 8 |
# File 'lib/xml_patch/applicator.rb', line 6 def diff_xml @diff_xml end |
Instance Method Details
#to(target_xml) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/xml_patch/applicator.rb', line 12 def to(target_xml) diff = XmlPatch::DiffBuilder.new.parse(diff_xml).diff_document target = XmlPatch::TargetDocument.new(target_xml) diff.apply_to(target) target.to_xml end |