Class: VORuby::STC::V1_10::Coords::TimeOffset
- Inherits:
-
Object
- Object
- VORuby::STC::V1_10::Coords::TimeOffset
- Includes:
- RelativeTime
- Defined in:
- lib/voruby/stc/1.10/coords.rb
Overview
Actual elapsed time offset
Instance Attribute Summary collapse
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#unit ⇒ Object
Returns the value of attribute unit.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(offset, unit = TimeUnit.new('s')) ⇒ TimeOffset
constructor
A new instance of TimeOffset.
- #to_s ⇒ Object
- #to_xml ⇒ Object
Methods included from RelativeTime
Methods included from SerializableToXml
Constructor Details
#initialize(offset, unit = TimeUnit.new('s')) ⇒ TimeOffset
Returns a new instance of TimeOffset.
243 244 245 246 |
# File 'lib/voruby/stc/1.10/coords.rb', line 243 def initialize(offset, unit=TimeUnit.new('s')) self.offset = offset self.unit = unit end |
Instance Attribute Details
#offset ⇒ Object
Returns the value of attribute offset.
241 242 243 |
# File 'lib/voruby/stc/1.10/coords.rb', line 241 def offset @offset end |
#unit ⇒ Object
Returns the value of attribute unit.
241 242 243 |
# File 'lib/voruby/stc/1.10/coords.rb', line 241 def unit @unit end |
Class Method Details
.from_xml(xml) ⇒ Object
268 269 270 271 272 273 274 |
# File 'lib/voruby/stc/1.10/coords.rb', line 268 def self.from_xml(xml) node = element_from(xml) TimeOffset.new( Float(node.text), node.attributes.get_attribute_ns(obj_ns.uri, 'unit').value ) end |
Instance Method Details
#to_s ⇒ Object
256 257 258 |
# File 'lib/voruby/stc/1.10/coords.rb', line 256 def to_s "#{self.offset} #{self.unit}" end |
#to_xml ⇒ Object
260 261 262 263 264 265 266 |
# File 'lib/voruby/stc/1.10/coords.rb', line 260 def to_xml el = element() el.text = self.offset.to_s el.attributes["#{obj_ns.prefix}:unit"] = self.unit.to_s collapse_namespaces(el) el end |