Class: Geocoder::Lookup::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/geocoder/lookups/base.rb

Direct Known Subclasses

Freegeoip, GeocoderCa, Google, Yahoo

Instance Method Summary collapse

Instance Method Details

#search(*args) ⇒ Object

Query the geocoding API and return a Geocoder::Result object. Returns nil on timeout or error.

Takes a search string (eg: “Mississippi Coast Coliseumf, Biloxi, MS”, “205.128.54.202”) for geocoding, or coordinates (latitude, longitude) for reverse geocoding. Returns an array of Geocoder::Results.



23
24
25
26
# File 'lib/geocoder/lookups/base.rb', line 23

def search(*args)
  reverse = (args.size == 2) || coordinates?(args.first)
  results(args.join(","), reverse).map{ |r| result_class.new(r) }
end