Class: KML::Object
- Inherits:
-
Object
- Object
- KML::Object
- Defined in:
- lib/kml/object.rb
Overview
Base class for all KML objects
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
The KML object ID.
Instance Method Summary collapse
-
#initialize(attributes = nil) ⇒ Object
constructor
Initialize the object, optionally passing a Hash of attributes to set.
- #parse(node) ⇒ Object
Constructor Details
#initialize(attributes = nil) ⇒ Object
Initialize the object, optionally passing a Hash of attributes to set.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/kml/object.rb', line 8 def initialize(attributes=nil) if attributes case attributes when Hash attributes.each do |name, value| self.__send__("#{name}=".to_sym, value) end else raise ArgumentError, "Attributes must be specified as a Hash" end end end |
Instance Attribute Details
Instance Method Details
#parse(node) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/kml/object.rb', line 21 def parse(node) self.id = node['id'] node.element_children.each do |cld| yield cld end self end |