Class: TimeSpan
- Inherits:
-
TimePrimitive
- Object
- KMLObject
- TimePrimitive
- 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 KMLObject
Instance Method Summary collapse
-
#initialize(t_begin, t_end) ⇒ TimeSpan
constructor
A new instance of TimeSpan.
- #to_kml(indent = 0, ns = nil) ⇒ Object
Constructor Details
#initialize(t_begin, t_end) ⇒ TimeSpan
Returns a new instance of TimeSpan.
497 498 499 500 501 |
# File 'lib/kamelopard/classes.rb', line 497 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.
496 497 498 |
# File 'lib/kamelopard/classes.rb', line 496 def begin @begin end |
#end ⇒ Object
Returns the value of attribute end.
496 497 498 |
# File 'lib/kamelopard/classes.rb', line 496 def end @end end |
Instance Method Details
#to_kml(indent = 0, ns = nil) ⇒ Object
503 504 505 506 507 508 509 510 511 512 |
# File 'lib/kamelopard/classes.rb', line 503 def to_kml(indent = 0, ns = nil) prefix = '' prefix = ns + ':' unless ns.nil? k = super(indent + 4) + "#{ ' ' * indent }<#{ prefix }TimeSpan id=\"#{ @id }\">\n" k << "#{ ' ' * indent } <begin>#{ @begin }</begin>\n" unless @begin.nil? k << "#{ ' ' * indent } <end>#{ @end }</end>\n" unless @end.nil? k << "#{ ' ' * indent }</#{ prefix }TimeSpan>\n" k end |