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.



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

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.



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

def when
  @when
end

Instance Method Details

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



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

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