Class: Resync::XML::ChangeNode
- Inherits:
-
XML::Mapping::SingleAttributeNode
- Object
- XML::Mapping::SingleAttributeNode
- Resync::XML::ChangeNode
- Defined in:
- lib/resync/xml.rb
Overview
Maps Resync::Types::Change values.
Instance Method Summary collapse
-
#extract_attr_value(xml) ⇒ Object
Implements ::XML::Mapping::SingleAttributeNode#extract_attr_value.
-
#initialize(*args) ⇒ ChangeNode
constructor
A new instance of ChangeNode.
-
#set_attr_value(xml, value) ⇒ Object
Implements ::XML::Mapping::SingleAttributeNode#set_attr_value.
Constructor Details
#initialize(*args) ⇒ ChangeNode
Returns a new instance of ChangeNode.
113 114 115 116 117 |
# File 'lib/resync/xml.rb', line 113 def initialize(*args) path, *args = super(*args) @path = ::XML::XXPath.new(path) args end |
Instance Method Details
#extract_attr_value(xml) ⇒ Object
Implements ::XML::Mapping::SingleAttributeNode#extract_attr_value.
120 121 122 |
# File 'lib/resync/xml.rb', line 120 def extract_attr_value(xml) Resync::Types::Change.parse(default_when_xpath_err { @path.first(xml).text }) end |
#set_attr_value(xml, value) ⇒ Object
Implements ::XML::Mapping::SingleAttributeNode#set_attr_value.
125 126 127 |
# File 'lib/resync/xml.rb', line 125 def set_attr_value(xml, value) @path.first(xml, ensure_created: true).text = value.to_s end |