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. Refer to the KML documentation to see which formats are available.

Instance Attribute Summary collapse

Attributes inherited from Object

#comment, #kml_id, #master_only

Instance Method Summary collapse

Methods inherited from Object

#_alternate_to_kml, #change, #master_only?, parse

Constructor Details

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

Returns a new instance of TimeStamp.


768
769
770
771
# File 'lib/kamelopard/classes.rb', line 768

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


767
768
769
# File 'lib/kamelopard/classes.rb', line 767

def when
  @when
end

Instance Method Details

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


773
774
775
776
777
778
779
780
781
782
783
784
# File 'lib/kamelopard/classes.rb', line 773

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