Class: XML::MappingExtensions::TimeNode
- Inherits:
-
NodeBase
- Object
- XML::Mapping::SingleAttributeNode
- NodeBase
- XML::MappingExtensions::TimeNode
- Defined in:
- lib/xml/mapping_extensions/time_node.rb
Overview
Maps Time objects to ISO 8601 strings.
Instance Method Summary collapse
-
#to_value(xml_text) ⇒ Time
param xml_text [String] an ISO 8601 datetime value.
-
#to_xml_text(value) ⇒ Object
The value as an ISO 8601 string.
Methods inherited from NodeBase
#extract_attr_value, #initialize, #set_attr_value
Constructor Details
This class inherits a constructor from XML::MappingExtensions::NodeBase
Instance Method Details
#to_value(xml_text) ⇒ Time
param xml_text [String] an ISO 8601 datetime value
11 12 13 |
# File 'lib/xml/mapping_extensions/time_node.rb', line 11 def to_value(xml_text) Time.iso8601(xml_text).utc end |
#to_xml_text(value) ⇒ Object
Returns the value as an ISO 8601 string.
17 18 19 |
# File 'lib/xml/mapping_extensions/time_node.rb', line 17 def to_xml_text(value) value.utc.iso8601 end |