# maps each element type to the model class which handles it
MODELS = {
- "node" => Node,
- "way" => Way,
+ "node" => Node,
+ "way" => Way,
"relation" => Relation
}.freeze
# NOTE: XML::Reader#read returns false for EOF and raises an
# exception if an error occurs.
@reader.read
- rescue LibXML::XML::Error => ex
- raise OSM::APIBadXMLError.new("changeset", xml, ex.message)
+ rescue LibXML::XML::Error => e
+ raise OSM::APIBadXMLError.new("changeset", xml, e.message)
end
##
attributes = {}
if @reader.has_attributes?
- while @reader.move_to_next_attribute == 1
- attributes[@reader.name] = @reader.value
- end
+ attributes[@reader.name] = @reader.value while @reader.move_to_next_attribute == 1
@reader.move_to_element
end
# such as save_ and delete_with_history.
def check(model, xml, new)
raise OSM::APIBadXMLError.new(model, xml) if new.nil?
- unless new.changeset_id == @changeset.id
- raise OSM::APIChangesetMismatchError.new(new.changeset_id, @changeset.id)
- end
+ raise OSM::APIChangesetMismatchError.new(new.changeset_id, @changeset.id) unless new.changeset_id == @changeset.id
end
##