Sha256: bc0fac48e6037bdf221eb22a64d7220ae74e706e0d5b8c767eccc625a8ea06fb
Contents?: true
Size: 555 Bytes
Versions: 22
Compression:
Stored size: 555 Bytes
Contents
require_relative 'node_base' module XML module MappingExtensions # Maps `Time` objects to ISO 8601 strings. class TimeNode < NodeBase # param xml_text [String] an ISO 8601 datetime value # @return [Time] the value as a UTC `Time` def to_value(xml_text) Time.iso8601(xml_text).utc end # @param value [Time] the value as a `Time` # @return the value as an ISO 8601 string def to_xml_text(value) value.utc.iso8601 end end ::XML::Mapping.add_node_class TimeNode end end
Version data entries
22 entries across 22 versions & 1 rubygems