Skip to content
Snippets Groups Projects
Commit 2216dccf authored by Alex Reisner's avatar Alex Reisner
Browse files

Refactor for readability.

parent 4af45d7a
No related branches found
No related tags found
No related merge requests found
......@@ -23,17 +23,17 @@ module Geocoder::Lookup
private # ---------------------------------------------------------------
def base_url(query)
text = URI.escape(query.sanitized_text.strip)
url = "#{protocol}://dev.virtualearth.net/REST/v1/Locations/"
if !query.reverse_geocode?
if query.reverse_geocode?
url + "#{text}?"
else
if r = query.options[:region]
url << "#{r}/"
end
# use the more forgiving 'unstructured' query format to allow special
# chars, newlines, brackets, typos.
url + "?q=" + URI.escape(query.sanitized_text.strip) + "&"
else
url + "#{URI.escape(query.sanitized_text.strip)}?"
url + "?q=#{text}&"
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment