Class: Kamelopard::Wait
- Inherits:
-
TourPrimitive
- Object
- Object
- TourPrimitive
- Kamelopard::Wait
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to a KML gx:Wait object
Instance Attribute Summary collapse
-
#duration ⇒ Object
Returns the value of attribute duration.
Attributes inherited from TourPrimitive
Attributes inherited from Object
#comment, #kml_id, #master_only
Class Method Summary collapse
-
.parse(x) ⇒ Object
Accepts an XML node representing a gx:Wait KML object, and turns it into a Kamelopard::Wait object.
Instance Method Summary collapse
-
#initialize(duration = 0, options = {}) ⇒ Wait
constructor
A new instance of Wait.
- #to_kml(elem = nil) ⇒ Object
Methods inherited from Object
#_alternate_to_kml, #change, #master_only?
Constructor Details
#initialize(duration = 0, options = {}) ⇒ Wait
Returns a new instance of Wait.
1941 1942 1943 1944 |
# File 'lib/kamelopard/classes.rb', line 1941 def initialize(duration = 0, = {}) super @duration = duration end |
Instance Attribute Details
#duration ⇒ Object
Returns the value of attribute duration.
1940 1941 1942 |
# File 'lib/kamelopard/classes.rb', line 1940 def duration @duration end |
Class Method Details
.parse(x) ⇒ Object
Accepts an XML node representing a gx:Wait KML object, and turns it into a Kamelopard::Wait object
1948 1949 1950 1951 1952 1953 1954 1955 |
# File 'lib/kamelopard/classes.rb', line 1948 def self.parse(x) dur = nil id = x.attributes['id'] if x.attributes? 'id' w.find('//gx:duration').each do |d| dur = d.children[0].to_s.to_f return Wait.new(dur, :id => id) end end |
Instance Method Details
#to_kml(elem = nil) ⇒ Object
1957 1958 1959 1960 1961 1962 1963 1964 1965 |
# File 'lib/kamelopard/classes.rb', line 1957 def to_kml(elem = nil) k = XML::Node.new 'gx:Wait' super k d = XML::Node.new 'gx:duration' d << @duration.to_s k << d elem << k unless elem.nil? k end |