Class: Pdf::Label::LengthNode
- Inherits:
-
XML::Mapping::SingleAttributeNode
- Object
- XML::Mapping::SingleAttributeNode
- Pdf::Label::LengthNode
- Defined in:
- lib/pdf/label/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
39 40 41 42 |
# File 'lib/pdf/label/length_node.rb', line 39 def extract_attr_value(xml) @value = default_when_xpath_err{@path.first(xml).text} Length.new(@value) end |
#initialize_impl(path) ⇒ Object
35 36 37 |
# File 'lib/pdf/label/length_node.rb', line 35 def initialize_impl(path) @path = XML::XXPath.new(path) end |
#set_attr_value(xml, value) ⇒ Object
44 45 46 47 |
# File 'lib/pdf/label/length_node.rb', line 44 def set_attr_value(xml, value) raise "Not a Length: #{value}" unless Length===value @path.first(xml,:ensure_created=>true).text = value.value end |