Class: VORuby::VOResource::Mapping::DateTimeNode
- Inherits:
-
XML::Mapping::SingleAttributeNode
- Object
- XML::Mapping::SingleAttributeNode
- VORuby::VOResource::Mapping::DateTimeNode
show all
- Defined in:
- lib/voruby/resources/nodes.rb
Instance Method Summary
collapse
Instance Method Details
14
15
16
17
|
# File 'lib/voruby/resources/nodes.rb', line 14
def (xml)
txt = default_when_xpath_err{ @path.first(xml).text }
DateTime.parse(txt)
end
|
#initialize_impl(path) ⇒ Object
10
11
12
|
# File 'lib/voruby/resources/nodes.rb', line 10
def initialize_impl(path)
@path = XML::XXPath.new(path)
end
|
#set_attr_value(xml, value) ⇒ Object
19
20
21
22
|
# File 'lib/voruby/resources/nodes.rb', line 19
def set_attr_value(xml, value)
raise RuntimeError, "Not a date/time: #{value}" unless Time === value
@path.first(xml, :ensure_created => true).text = value.to_s
end
|