Class: VORuby::STC::V1_10::Coords::StringCoordinate
- Inherits:
-
CoordinateType
- Object
- CoordinateType
- VORuby::STC::V1_10::Coords::StringCoordinate
- Includes:
- Coordinate
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Overview
Generic string coordinate element
Instance Attribute Summary collapse
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from CoordinateType
Class Method Summary collapse
Instance Method Summary collapse
Methods included from SerializableToXml
Methods inherited from CoordinateType
Constructor Details
This class inherits a constructor from VORuby::STC::V1_10::Coords::CoordinateType
Instance Attribute Details
#unit ⇒ Object
Returns the value of attribute unit.
1269 1270 1271 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1269 def unit @unit end |
#value ⇒ Object
Returns the value of attribute value.
1269 1270 1271 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1269 def value @value end |
Class Method Details
.from_xml(xml) ⇒ Object
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1303 def self.from_xml(xml) root = element_from(xml) = { :name => REXML::XPath.first(root, 'x:Name', {'x' => obj_ns.uri}).text, :value => REXML::XPath.first(root, 'x:Value', {'x' => obj_ns.uri}).text } unit = root.attributes.get_attribute_ns(obj_ns.uri, 'unit') ['unit'] = unit.value if unit StringCoordinate.new() end |
Instance Method Details
#==(c) ⇒ Object
1279 1280 1281 1282 1283 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1279 def ==(c) super(c) and self.value == c.value and self.unit == c.unit end |
#to_xml ⇒ Object
1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 |
# File 'lib/voruby/stc/1.10/coords.rb', line 1285 def to_xml el = element() el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s if self.unit name = REXML::Element.new("#{obj_ns.prefix}:Name") name.text = self.name value = REXML::Element.new("#{obj_ns.prefix}:Value") value.text = self.value el.add_element(name) el.add_element(value) collapse_namespaces(el) el end |