Class: VORuby::STC::V1_10::Coords::JDTime

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

Overview

JD time

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) ⇒ JDTime

Returns a new instance of JDTime.



134
135
136
# File 'lib/voruby/stc/1.10/coords.rb', line 134

def initialize(dt)
  self.value = dt
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



132
133
134
# File 'lib/voruby/stc/1.10/coords.rb', line 132

def value
  @value
end

Class Method Details

.from_xml(xml) ⇒ Object



157
158
159
# File 'lib/voruby/stc/1.10/coords.rb', line 157

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

Instance Method Details

#to_datetimeObject



146
147
148
# File 'lib/voruby/stc/1.10/coords.rb', line 146

def to_datetime
  DateTime.jd(self.value)
end

#to_sObject



142
143
144
# File 'lib/voruby/stc/1.10/coords.rb', line 142

def to_s
  self.value.to_s
end

#to_xmlObject



150
151
152
153
154
155
# File 'lib/voruby/stc/1.10/coords.rb', line 150

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