Class: TimeStamp

Inherits:
TimePrimitive show all
Defined in:
lib/kamelopard/classes.rb

Overview

Corresponds to KML’s TimeStamp object. The @when attribute must be in a format KML understands.

Instance Attribute Summary collapse

Attributes inherited from KMLObject

#comment, #id

Instance Method Summary collapse

Constructor Details

#initialize(t_when) ⇒ TimeStamp

Returns a new instance of TimeStamp.



475
476
477
478
# File 'lib/kamelopard/classes.rb', line 475

def initialize(t_when)
    super()
    @when = t_when
end

Instance Attribute Details

#whenObject

Returns the value of attribute when.



474
475
476
# File 'lib/kamelopard/classes.rb', line 474

def when
  @when
end

Instance Method Details

#to_kml(indent = 0, ns = nil) ⇒ Object



480
481
482
483
484
485
486
487
488
489
490
# File 'lib/kamelopard/classes.rb', line 480

def to_kml(indent = 0, ns = nil)
    prefix = ''
    prefix = ns + ':' unless ns.nil?
    
    k = super(indent + 4)
    k << <<-timestamp
#{ ' ' * indent }<#{ prefix }TimeStamp id="#{ @id }">
#{ ' ' * indent }    <when>#{ @when }</when>
#{ ' ' * indent }</#{ prefix }TimeStamp>
    timestamp
end