Class: Kamelopard::SchemaData
- Inherits:
-
Object
- Object
- Kamelopard::SchemaData
- Defined in:
- lib/kamelopard/classes.rb
Overview
Corresponds to KML’s ExtendedData SchemaData objects
Instance Attribute Summary collapse
-
#schemaUrl ⇒ Object
Returns the value of attribute schemaUrl.
-
#simpleData ⇒ Object
Returns the value of attribute simpleData.
Instance Method Summary collapse
- #<<(a) ⇒ Object
-
#initialize(schemaUrl, simpleData = {}) ⇒ SchemaData
constructor
A new instance of SchemaData.
- #to_kml(elem = nil) ⇒ Object
Constructor Details
#initialize(schemaUrl, simpleData = {}) ⇒ SchemaData
Returns a new instance of SchemaData.
750 751 752 753 754 |
# File 'lib/kamelopard/classes.rb', line 750 def initialize(schemaUrl, simpleData = {}) @schemaUrl = schemaUrl raise "SchemaData's simpleData attribute should behave like a hash" unless simpleData.respond_to? :keys @simpleData = simpleData end |
Instance Attribute Details
#schemaUrl ⇒ Object
Returns the value of attribute schemaUrl.
749 750 751 |
# File 'lib/kamelopard/classes.rb', line 749 def schemaUrl @schemaUrl end |
#simpleData ⇒ Object
Returns the value of attribute simpleData.
749 750 751 |
# File 'lib/kamelopard/classes.rb', line 749 def simpleData @simpleData end |
Instance Method Details
#<<(a) ⇒ Object
756 757 758 |
# File 'lib/kamelopard/classes.rb', line 756 def <<(a) @simpleData.merge a end |
#to_kml(elem = nil) ⇒ Object
760 761 762 763 764 765 766 767 768 769 770 |
# File 'lib/kamelopard/classes.rb', line 760 def to_kml(elem = nil) s = XML::Node.new 'SchemaData' s.attributes['schemaUrl'] = @schemaUrl @simpleData.each do |k, v| sd = XML::Node.new 'SimpleData', v sd.attributes['name'] = k s << sd end elem << v unless elem.nil? v end |