Class: VORuby::STC::V1_10::Coords::MJDTime
- Inherits:
-
Object
- Object
- VORuby::STC::V1_10::Coords::MJDTime
- Includes:
- AbsoluteTime
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Overview
MJD time (=JD - 2400000.5)
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dt) ⇒ MJDTime
constructor
A new instance of MJDTime.
- #to_datetime ⇒ Object
- #to_s ⇒ Object
- #to_xml ⇒ Object
Methods included from AbsoluteTime
Methods included from SerializableToXml
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
#value ⇒ Object
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_datetime ⇒ Object
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_s ⇒ Object
181 182 183 |
# File 'lib/voruby/stc/1.10/coords.rb', line 181 def to_s self.value.to_s end |
#to_xml ⇒ Object
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 |