Class: Kamelopard::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 Object

#comment, #id

Instance Method Summary collapse

Constructor Details

#initialize(t_when) ⇒ TimeStamp

Returns a new instance of TimeStamp.



491
492
493
494
# File 'lib/kamelopard/classes.rb', line 491

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

Instance Attribute Details

#whenObject

Returns the value of attribute when.



490
491
492
# File 'lib/kamelopard/classes.rb', line 490

def when
  @when
end

Instance Method Details

#to_kml(elem = nil, ns = nil) ⇒ Object



496
497
498
499
500
501
502
503
504
505
506
507
# File 'lib/kamelopard/classes.rb', line 496

def to_kml(elem = nil, ns = nil)
    prefix = ''
    prefix = ns + ':' unless ns.nil?
    
    k = REXML::Element.new "#{prefix}TimeStamp"
    super(k)
    w = REXML::Element.new 'when'
    w.text = @when
    k.elements << w
    elem.elements << k unless elem.nil?
    k
end