Class: Resync::XML::UriNode
- Inherits:
-
XML::Mapping::SingleAttributeNode
- Object
- XML::Mapping::SingleAttributeNode
- Resync::XML::UriNode
- Defined in:
- lib/resync/xml.rb
Overview
Maps URI objects.
Instance Method Summary collapse
-
#extract_attr_value(xml) ⇒ Object
Implements ::XML::Mapping::SingleAttributeNode#extract_attr_value.
-
#initialize(*args) ⇒ UriNode
constructor
A new instance of UriNode.
-
#set_attr_value(xml, value) ⇒ Object
Implements ::XML::Mapping::SingleAttributeNode#set_attr_value.
Constructor Details
#initialize(*args) ⇒ UriNode
Returns a new instance of UriNode.
86 87 88 89 90 |
# File 'lib/resync/xml.rb', line 86 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.
93 94 95 |
# File 'lib/resync/xml.rb', line 93 def extract_attr_value(xml) URI(default_when_xpath_err { @path.first(xml).text }) end |
#set_attr_value(xml, value) ⇒ Object
Implements ::XML::Mapping::SingleAttributeNode#set_attr_value.
98 99 100 |
# File 'lib/resync/xml.rb', line 98 def set_attr_value(xml, value) @path.first(xml, ensure_created: true).text = value.to_s end |