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.
745 746 747 748 749 |
# File 'lib/kamelopard/classes.rb', line 745 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.
744 745 746 |
# File 'lib/kamelopard/classes.rb', line 744 def schemaUrl @schemaUrl end |
#simpleData ⇒ Object
Returns the value of attribute simpleData.
744 745 746 |
# File 'lib/kamelopard/classes.rb', line 744 def simpleData @simpleData end |
Instance Method Details
#<<(a) ⇒ Object
751 752 753 |
# File 'lib/kamelopard/classes.rb', line 751 def <<(a) @simpleData.merge a end |
#to_kml(elem = nil) ⇒ Object
755 756 757 758 759 760 761 762 763 764 765 |
# File 'lib/kamelopard/classes.rb', line 755 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 |