Class: Geocoder::Lookup::Base
- Inherits:
-
Object
- Object
- Geocoder::Lookup::Base
- Defined in:
- lib/geocoder/lookups/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#search(*args) ⇒ Object
Query the geocoding API and return a Geocoder::Result object.
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::Result
s.
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 |