Fix new rubocop warnings

This commit is contained in:
Tom Hughes 2020-08-06 18:36:59 +01:00
parent 5ece1572d0
commit 0e2a66e8de
24 changed files with 152 additions and 116 deletions

View file

@ -55,11 +55,13 @@ class Way < ApplicationRecord
def self.from_xml(xml, create = false)
p = XML::Parser.string(xml, :options => XML::Parser::Options::NOERROR)
doc = p.parse
pt = doc.find_first("//osm/way")
doc.find("//osm/way").each do |pt|
return Way.from_xml_node(pt, create)
if pt
Way.from_xml_node(pt, create)
else
raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/way element.")
end
raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/way element.")
rescue LibXML::XML::Error, ArgumentError => e
raise OSM::APIBadXMLError.new("way", xml, e.message)
end
@ -114,9 +116,7 @@ class Way < ApplicationRecord
@tags ||= Hash[way_tags.collect { |t| [t.k, t.v] }]
end
attr_writer :nds
attr_writer :tags
attr_writer :nds, :tags
def add_nd_num(n)
@nds ||= []