]> git.openstreetmap.org Git - rails.git/blobdiff - lib/object_metadata.rb
Update country.rb
[rails.git] / lib / object_metadata.rb
index d4d0bcfc784260c048e5443bfcd444c2efb7aadc..c765df5264d6b749e59e178d847e618e84f40f6e 100644 (file)
@@ -1,10 +1,10 @@
 module ObjectMetadata
   def add_metadata_to_xml_node(el, osm, changeset_cache, user_display_name_cache)
-    el['changeset'] = osm.changeset_id.to_s
-    el['redacted'] = osm.redaction.id.to_s if osm.redacted?
-    el['timestamp'] = osm.timestamp.xmlschema
-    el['version'] = osm.version.to_s
-    el['visible'] = osm.visible.to_s
+    el["changeset"] = osm.changeset_id.to_s
+    el["redacted"] = osm.redaction.id.to_s if osm.redacted?
+    el["timestamp"] = osm.timestamp.xmlschema
+    el["version"] = osm.version.to_s
+    el["visible"] = osm.visible.to_s
 
     if changeset_cache.key?(osm.changeset_id)
       # use the cache if available
@@ -23,8 +23,19 @@ module ObjectMetadata
     end
 
     unless user_display_name_cache[user_id].nil?
-      el['user'] = user_display_name_cache[user_id]
-      el['uid'] = user_id.to_s
+      el["user"] = user_display_name_cache[user_id]
+      el["uid"] = user_id.to_s
+    end
+  end
+
+  def add_tags_to_xml_node(el, tags)
+    tags.each do |tag|
+      tag_el = XML::Node.new("tag")
+
+      tag_el["k"] = tag.k
+      tag_el["v"] = tag.v
+
+      el << tag_el
     end
   end
 end