Class: LengthNode
- Inherits:
-
XML::Mapping::SingleAttributeNode
- Object
- XML::Mapping::SingleAttributeNode
- LengthNode
- Defined in:
- lib/length_node.rb
Instance Method Summary collapse
- #extract_attr_value(xml) ⇒ Object
- #initialize_impl(path) ⇒ Object
- #set_attr_value(xml, value) ⇒ Object
Instance Method Details
#extract_attr_value(xml) ⇒ Object
36 37 38 39 |
# File 'lib/length_node.rb', line 36 def extract_attr_value(xml) @value = default_when_xpath_err{@path.first(xml).text} Length.new(@value) end |
#initialize_impl(path) ⇒ Object
32 33 34 |
# File 'lib/length_node.rb', line 32 def initialize_impl(path) @path = XML::XXPath.new(path) end |
#set_attr_value(xml, value) ⇒ Object
41 42 43 44 |
# File 'lib/length_node.rb', line 41 def set_attr_value(xml, value) raise "Not a Length: #{value}" unless Length===value @path.first(xml,:ensure_created=>true).text = value.value end |