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
110 111 112 113 114 |
# File 'lib/resync/xml.rb', line 110 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.
117 118 119 |
# File 'lib/resync/xml.rb', line 117 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.
122 123 124 |
# File 'lib/resync/xml.rb', line 122 def set_attr_value(xml, value) @path.first(xml, ensure_created: true).text = value.to_s end |