Class: VORuby::STC::V1_10::Coords::Redshift
- Inherits:
-
ScalarCoordinateType
- Object
- CoordinateType
- ScalarCoordinateType
- VORuby::STC::V1_10::Coords::Redshift
- Includes:
- SerializableToXml
- Defined in:
- lib/voruby/stc/1.10/coords.rb
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 ScalarCoordinateType
#error, #pix_size, #resolution, #size, #value
Attributes inherited from CoordinateType
Class Method Summary collapse
Instance Method Summary collapse
Methods included from SerializableToXml
Methods inherited from ScalarCoordinateType
Methods inherited from CoordinateType
Constructor Details
This class inherits a constructor from VORuby::STC::V1_10::Coords::ScalarCoordinateType
Instance Attribute Details
#unit ⇒ Object
Returns the value of attribute unit.
2079 2080 2081 |
# File 'lib/voruby/stc/1.10/coords.rb', line 2079 def unit @unit end |
#vel_time_unit ⇒ Object
Returns the value of attribute vel_time_unit.
2079 2080 2081 |
# File 'lib/voruby/stc/1.10/coords.rb', line 2079 def vel_time_unit @vel_time_unit end |
Class Method Details
.from_xml(xml) ⇒ Object
2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 |
# File 'lib/voruby/stc/1.10/coords.rb', line 2111 def self.from_xml(xml) root = element_from(xml) = { :name => REXML::XPath.first(root, 'x:Name', {'x' => obj_ns.uri}).text } 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 [:value] = xml_to_obj(root, CValue, true) [:error] = xml_to_obj(root, CError) [:resolution] = xml_to_obj(root, CResolution) [:size] = xml_to_obj(root, CSize) [:pix_size] = xml_to_obj(root, CPixSize) Redshift.new() end |
Instance Method Details
#==(c) ⇒ Object
2130 2131 2132 2133 2134 |
# File 'lib/voruby/stc/1.10/coords.rb', line 2130 def ==(c) super(c) and self.unit == c.unit and self.vel_time_unit == c.vel_time_unit end |
#to_xml ⇒ Object
2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 |
# File 'lib/voruby/stc/1.10/coords.rb', line 2091 def to_xml el = element() 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 name = REXML::Element.new("#{obj_ns.prefix}:Name") name.text = self.name el.add_element(name) el.add_element(self.value.to_xml) if self.value self.error.each { |e| el.add_element(e.to_xml) } if self.error self.resolution.each { |r| el.add_element(r.to_xml) } if self.resolution self.size.each { |s| el.add_element(s.to_xml) } if self.size self.pix_size.each { |p| el.add_element(p.to_xml) } if self.pix_size collapse_namespaces(el) el end |