Sha256: 1524a0bd2a646a156545f3cc4a4f2103e671ed03f8196d805e0fd430bd9fd060
Contents?: true
Size: 891 Bytes
Versions: 2
Compression:
Stored size: 891 Bytes
Contents
module Rosemary # A collection of OSM tags which can be attached to a Node, Way, # or Relation. # It is a subclass of Hash. class Tags < Hash # Return XML for these tags. This method uses the Builder library. # The only parameter ist the builder object. def to_xml(options = {}) xml = options[:builder] ||= Builder::XmlMarkup.new xml.instruct! unless options[:skip_instruct] each do |key, value| xml.tag(:k => key, :v => value) unless value.blank? end unless empty? end def []=(key, value) # Ignore empty values, cause we don't want them in the OSM anyways return if value.blank? super(key, value.strip) end # Return string with comma separated key=value pairs. # # @return [String] string representation # def to_s sort.collect{ |k, v| "#{k}=#{v}" }.join(', ') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rosemary-0.3.11 | lib/rosemary/tags.rb |
rosemary-0.3.10 | lib/rosemary/tags.rb |