Class: VORuby::STC::V1_30::ISOTimeType
- Inherits:
-
Object
- Object
- VORuby::STC::V1_30::ISOTimeType
- Includes:
- STCReference
- Defined in:
- lib/voruby/stc/1.30/stc.rb
Overview
ISO8601 time; note: only a limited subset of ISO 8601 is allowed: yyyy-mm-ddThh:mm:ss.sss…; unfortunately, XSchema does not allow hh, mm, or ss to be optional, “.ss” is.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Attributes included from STCReference
#id, #idref, #ucd, #xlink_href, #xlink_type
Class Method Summary collapse
Instance Method Summary collapse
- #==(t) ⇒ Object
-
#initialize(value, options = {}) ⇒ ISOTimeType
constructor
A new instance of ISOTimeType.
- #to_xml(name = nil) ⇒ Object
Methods included from STCReference
#stc_reference_eq, stc_reference_from_xml, #stc_reference_to_xml
Methods included from SerializableToXml
Constructor Details
#initialize(value, options = {}) ⇒ ISOTimeType
Returns a new instance of ISOTimeType.
299 300 301 302 |
# File 'lib/voruby/stc/1.30/stc.rb', line 299 def initialize(value, ={}) self.value = value .each { |key, v| send("#{key}=", v) } end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
297 298 299 |
# File 'lib/voruby/stc/1.30/stc.rb', line 297 def value @value end |
Class Method Details
.from_xml(xml) ⇒ Object
323 324 325 326 327 328 329 330 |
# File 'lib/voruby/stc/1.30/stc.rb', line 323 def self.from_xml(xml) root = element_from(xml) value = DateTime.parse(root.text) = STCReference.stc_reference_from_xml(root) self.new(value, ) end |
Instance Method Details
#==(t) ⇒ Object
309 310 311 312 |
# File 'lib/voruby/stc/1.30/stc.rb', line 309 def ==(t) self.stc_reference_eq(t) and self.value == t.value end |
#to_xml(name = nil) ⇒ Object
314 315 316 317 318 319 320 321 |
# File 'lib/voruby/stc/1.30/stc.rb', line 314 def to_xml(name=nil) el = stc_reference_to_xml(element(name)) el.text = self.value.strftime("%FT%T.%L") collapse_namespaces(el) el end |