Class: VORuby::STC::V1_10::STC::RedshiftInterval
- Inherits:
-
CoordScalarIntervalType
- Object
- CoordIntervalType
- CoordScalarIntervalType
- VORuby::STC::V1_10::STC::RedshiftInterval
- Defined in:
- lib/voruby/stc/1.10/stc.rb
Overview
Contains a 1-D redshift interval; position and time units are required if redshifts are expressed as Doppler velocities
Instance Attribute Summary collapse
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#vel_time_unit ⇒ Object
Returns the value of attribute vel_time_unit.
Attributes inherited from CoordScalarIntervalType
Attributes inherited from CoordIntervalType
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from CoordIntervalType
#fill_factor, #fill_factor=, #initialize
Methods included from SerializableToXml
Constructor Details
This class inherits a constructor from VORuby::STC::V1_10::STC::CoordIntervalType
Instance Attribute Details
#unit ⇒ Object
Returns the value of attribute unit.
2452 2453 2454 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2452 def unit @unit end |
#vel_time_unit ⇒ Object
Returns the value of attribute vel_time_unit.
2452 2453 2454 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2452 def vel_time_unit @vel_time_unit end |
Class Method Details
.from_xml(xml) ⇒ Object
2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2481 def self.from_xml(xml) root = element_from(xml) = {} lo_include = root.attributes.get_attribute_ns(obj_ns.uri, 'lo_include') [:lo_include] = (lo_include.value == 'true' ? true : false) if lo_include hi_include = root.attributes.get_attribute_ns(obj_ns.uri, 'hi_include') [:hi_include] = (hi_include.value == 'true' ? true : false) if hi_include fill_factor = root.attributes.get_attribute_ns(obj_ns.uri, 'fill_factor') [:fill_factor] = Float(fill_factor.value) if fill_factor lo_limit = REXML::XPath.first(root, 'x:LoLimit', {'x' => obj_ns.uri}) [:lo_limit] = Float(lo_limit.text) if lo_limit hi_limit = REXML::XPath.first(root, 'x:HiLimit', {'x' => obj_ns.uri}) [:hi_limit] = Float(hi_limit.text) if hi_limit unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit') [:unit] = PosUnit.new(unit.value) if unit vel_time_unit = root.attributes.get_attribute_ns(obj_ns.uri, 'vel_time_unit') [:vel_time_unit] = VelTimeUnit.new(vel_time_unit.value) if vel_time_unit self.new() end |
Instance Method Details
#==(i) ⇒ Object
2466 2467 2468 2469 2470 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2466 def ==(i) super(i) and self.unit == i.unit and self.vel_time_unit == i.vel_time_unit end |
#to_xml(name = nil) ⇒ Object
2472 2473 2474 2475 2476 2477 2478 2479 |
# File 'lib/voruby/stc/1.10/stc.rb', line 2472 def to_xml(name=nil) el = super(name) el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit el.attributes["#{obj_ns.prefix}:vel_time_unit"] = self.vel_time_unit.to_s if self.vel_time_unit el end |