Class: VORuby::STC::V1_10::Coords::MJDTime

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

Overview

MJD time (=JD - 2400000.5)

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

Returns a new instance of MJDTime.



173
174
175
# File 'lib/voruby/stc/1.10/coords.rb', line 173

def initialize(dt)
  self.value = dt
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



171
172
173
# File 'lib/voruby/stc/1.10/coords.rb', line 171

def value
  @value
end

Class Method Details

.from_xml(xml) ⇒ Object



196
197
198
# File 'lib/voruby/stc/1.10/coords.rb', line 196

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

Instance Method Details

#to_datetimeObject



185
186
187
# File 'lib/voruby/stc/1.10/coords.rb', line 185

def to_datetime
  DateTime.jd(DateTime.mjd_to_jd(self.value))
end

#to_sObject



181
182
183
# File 'lib/voruby/stc/1.10/coords.rb', line 181

def to_s
  self.value.to_s
end

#to_xmlObject



189
190
191
192
193
194
# File 'lib/voruby/stc/1.10/coords.rb', line 189

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