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, #kml_id

Instance Method Summary collapse

Methods inherited from Object

#change

Constructor Details

#initialize(ts_when = nil, options = {}) ⇒ TimeStamp

Returns a new instance of TimeStamp.



504
505
506
507
# File 'lib/kamelopard/classes.rb', line 504

def initialize(ts_when = nil, options = {})
    super options
    @when = ts_when unless ts_when.nil?
end

Instance Attribute Details

#whenObject

Returns the value of attribute when.



503
504
505
# File 'lib/kamelopard/classes.rb', line 503

def when
  @when
end

Instance Method Details

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



509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/kamelopard/classes.rb', line 509

def to_kml(elem = nil, ns = nil)
    prefix = ''
    prefix = ns + ':' unless ns.nil?

    k = XML::Node.new "#{prefix}TimeStamp"
    super(k)
    w = XML::Node.new 'when'
    w << @when
    k << w
    elem << k unless elem.nil?
    k
end