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

Change lookup method: takes query instead of bool.

Figures out whether query is an IP address so you don't have to.
parent 6581c601
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ module Geocoder
if blank_query?(query)
results = []
else
results = lookup(ip_address?(query)).search(query)
results = lookup(query).search(query)
end
results.instance_eval do
def warn_search_deprecation(attr)
......@@ -107,10 +107,11 @@ module Geocoder
##
# Get a Lookup object (which communicates with the remote geocoding API).
# Returns an IP address lookup if +ip+ parameter true.
# Takes a search query and returns an IP or street address Lookup
# depending on the query contents.
#
def lookup(ip = false)
if ip
def lookup(query)
if ip_address?(query)
get_lookup(ip_lookups.first)
else
get_lookup(Configuration.lookup || street_lookups.first)
......
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