Class: VORuby::STC::V1_10::Coords::TimeOffsetRef
- Includes:
- RelativeTime
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Instance Attribute Summary collapse
-
#unit ⇒ Object
Returns the value of attribute unit.
Attributes inherited from IdRef
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ref, unit = TimeUnit.new('s')) ⇒ TimeOffsetRef
constructor
A new instance of TimeOffsetRef.
- #offset ⇒ Object
- #offset=(offset) ⇒ Object
- #to_s ⇒ Object
- #to_xml ⇒ Object
Methods included from RelativeTime
Methods included from SerializableToXml
Methods inherited from IdRef
Constructor Details
#initialize(ref, unit = TimeUnit.new('s')) ⇒ TimeOffsetRef
Returns a new instance of TimeOffsetRef.
282 283 284 285 |
# File 'lib/voruby/stc/1.10/coords.rb', line 282 def initialize(ref, unit=TimeUnit.new('s')) super(ref) self.unit = unit end |
Instance Attribute Details
#unit ⇒ Object
Returns the value of attribute unit.
280 281 282 |
# File 'lib/voruby/stc/1.10/coords.rb', line 280 def unit @unit end |
Class Method Details
.from_xml(xml) ⇒ Object
306 307 308 309 310 311 312 |
# File 'lib/voruby/stc/1.10/coords.rb', line 306 def self.from_xml(xml) node = element_from(xml) TimeOffsetRef.new( node.text, node.attributes.get_attribute_ns(obj_ns.uri, 'unit').value ) end |
Instance Method Details
#offset ⇒ Object
291 |
# File 'lib/voruby/stc/1.10/coords.rb', line 291 def offset; self.value end |
#offset=(offset) ⇒ Object
292 |
# File 'lib/voruby/stc/1.10/coords.rb', line 292 def offset=(offset); self.value = offset end |
#to_s ⇒ Object
294 295 296 |
# File 'lib/voruby/stc/1.10/coords.rb', line 294 def to_s "#{self.value} #{self.unit}" end |
#to_xml ⇒ Object
298 299 300 301 302 303 304 |
# File 'lib/voruby/stc/1.10/coords.rb', line 298 def to_xml el = element() el.text = self.value.to_s el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s collapse_namespaces(el) el end |