Avoid unnecessary arrays
This commit is contained in:
parent
d0de9967b9
commit
cf3cf5216f
11 changed files with 12 additions and 18 deletions
|
@ -31,7 +31,7 @@ module Api
|
|||
response.last_modified = node.timestamp
|
||||
|
||||
if node.visible
|
||||
@nodes = [node]
|
||||
@node = node
|
||||
|
||||
# Render the result
|
||||
respond_to do |format|
|
||||
|
|
|
@ -28,11 +28,7 @@ module Api
|
|||
@elements.unredacted
|
||||
end
|
||||
|
||||
@elems = []
|
||||
|
||||
visible_elements.each do |element|
|
||||
@elems << element
|
||||
end
|
||||
@elems = visible_elements
|
||||
|
||||
# Render the result
|
||||
respond_to do |format|
|
||||
|
@ -47,8 +43,6 @@ module Api
|
|||
else
|
||||
response.last_modified = @old_element.timestamp
|
||||
|
||||
@elems = [@old_element]
|
||||
|
||||
# Render the result
|
||||
respond_to do |format|
|
||||
format.xml
|
||||
|
|
|
@ -25,7 +25,7 @@ module Api
|
|||
relation = Relation.find(params[:id])
|
||||
response.last_modified = relation.timestamp
|
||||
if relation.visible
|
||||
@relations = [relation]
|
||||
@relation = relation
|
||||
|
||||
# Render the result
|
||||
respond_to do |format|
|
||||
|
|
|
@ -27,7 +27,7 @@ module Api
|
|||
response.last_modified = way.timestamp
|
||||
|
||||
if way.visible
|
||||
@ways = [way]
|
||||
@way = way
|
||||
|
||||
# Render the result
|
||||
respond_to do |format|
|
||||
|
@ -80,7 +80,7 @@ module Api
|
|||
end
|
||||
end
|
||||
|
||||
@ways = [way]
|
||||
@way = way
|
||||
|
||||
# Render the result
|
||||
respond_to do |format|
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
xml.instruct!
|
||||
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm << (render(@nodes) || "")
|
||||
osm << (render(@node) || "")
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
xml.instruct!
|
||||
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm << (render(@elems) || "")
|
||||
osm << (render(@old_element) || "")
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
xml.instruct!
|
||||
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm << (render(@elems) || "")
|
||||
osm << (render(@old_element) || "")
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
xml.instruct!
|
||||
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm << (render(@elems) || "")
|
||||
osm << (render(@old_element) || "")
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
xml.instruct!
|
||||
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm << (render(@relations) || "")
|
||||
osm << (render(@relation) || "")
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ xml.instruct!
|
|||
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm << (render(@nodes) || "")
|
||||
osm << (render(@ways) || "")
|
||||
osm << (render(@way) || "")
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
xml.instruct!
|
||||
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm << (render(@ways) || "")
|
||||
osm << (render(@way) || "")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue