Class: VORuby::STC::V1_10::Coords::ISOTime

Inherits:
Object
  • Object
show all
Includes:
AbsoluteTime
Defined in:
lib/voruby/stc/1.10/coords.rb

Overview

ISO8601 time; note: only a limited subset of ISO 8601 is allowed: yyyy-mm-ddThh:mm:ss.sss…

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AbsoluteTime

#==

Methods included from SerializableToXml

#element

Constructor Details

#initialize(dt) ⇒ ISOTime

Returns a new instance of ISOTime.



99
100
101
# File 'lib/voruby/stc/1.10/coords.rb', line 99

def initialize(dt)
  self.value = dt
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



97
98
99
# File 'lib/voruby/stc/1.10/coords.rb', line 97

def value
  @value
end

Class Method Details

.from_xml(xml) ⇒ Object



118
119
120
# File 'lib/voruby/stc/1.10/coords.rb', line 118

def self.from_xml(xml)
  ISOTime.new(element_from(xml).text)
end

Instance Method Details

#to_sObject



107
108
109
# File 'lib/voruby/stc/1.10/coords.rb', line 107

def to_s
  self.value.strftime("%FT%T.000")
end

#to_xmlObject



111
112
113
114
115
116
# File 'lib/voruby/stc/1.10/coords.rb', line 111

def to_xml
  el = element()
  el.text = self.to_s
  collapse_namespaces(el)
  el
end