Class: OpenStreetMap::Tags
Overview
A collection of OSM tags which can be attached to a Node, Way, or Relation. It is a subclass of Hash.
Instance Method Summary collapse
-
#to_s ⇒ Object
Return string with comma separated key=value pairs.
-
#to_xml(options = {}) ⇒ Object
Return XML for these tags.
Instance Method Details
#to_s ⇒ Object
Return string with comma separated key=value pairs.
call-seq: to_s -> String
21 22 23 |
# File 'lib/open_street_map/tags.rb', line 21 def to_s sort.collect{ |k, v| "#{k}=#{v}" }.join(', ') end |
#to_xml(options = {}) ⇒ Object
Return XML for these tags. This method uses the Builder library. The only parameter ist the builder object.
9 10 11 12 13 14 15 |
# File 'lib/open_street_map/tags.rb', line 9 def to_xml( = {}) xml = [:builder] ||= Builder::XmlMarkup.new xml.instruct! unless [:skip_instruct] each do |key, value| xml.tag(:k => key, :v => value) end unless empty? end |