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.
856 857 858 859 860 |
# File 'lib/kamelopard/classes.rb', line 856 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.
855 856 857 |
# File 'lib/kamelopard/classes.rb', line 855 def schemaUrl @schemaUrl end |
#simpleData ⇒ Object
Returns the value of attribute simpleData.
855 856 857 |
# File 'lib/kamelopard/classes.rb', line 855 def simpleData @simpleData end |
Instance Method Details
#<<(a) ⇒ Object
862 863 864 |
# File 'lib/kamelopard/classes.rb', line 862 def <<(a) @simpleData.merge a end |
#to_kml(elem = nil) ⇒ Object
866 867 868 869 870 871 872 873 874 875 876 |
# File 'lib/kamelopard/classes.rb', line 866 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 |