Class: Kamelopard::TimeSpan
- Inherits:
-
TimePrimitive
- Object
- Object
- TimePrimitive
- Kamelopard::TimeSpan
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to KML’s TimeSpan object. @begin and @end must be in a format KML understands.
Instance Attribute Summary collapse
-
#begin ⇒ Object
Returns the value of attribute begin.
-
#end ⇒ Object
Returns the value of attribute end.
Attributes inherited from Object
Instance Method Summary collapse
-
#initialize(t_begin, t_end) ⇒ TimeSpan
constructor
A new instance of TimeSpan.
- #to_kml(elem = nil, ns = nil) ⇒ Object
Constructor Details
#initialize(t_begin, t_end) ⇒ TimeSpan
Returns a new instance of TimeSpan.
514 515 516 517 518 |
# File 'lib/kamelopard/classes.rb', line 514 def initialize(t_begin, t_end) super() @begin = t_begin @end = t_end end |
Instance Attribute Details
#begin ⇒ Object
Returns the value of attribute begin.
513 514 515 |
# File 'lib/kamelopard/classes.rb', line 513 def begin @begin end |
#end ⇒ Object
Returns the value of attribute end.
513 514 515 |
# File 'lib/kamelopard/classes.rb', line 513 def end @end end |
Instance Method Details
#to_kml(elem = nil, ns = nil) ⇒ Object
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
# File 'lib/kamelopard/classes.rb', line 520 def to_kml(elem = nil, ns = nil) prefix = '' prefix = ns + ':' unless ns.nil? k = REXML::Element.new "#{prefix}TimeSpan" super(k) if not @begin.nil? then w = REXML::Element.new 'begin' w.text = @begin k.elements << w end if not @end.nil? then w = REXML::Element.new 'end' w.text = @end k.elements << w elem.elements << k unless elem.nil? end k end |