Module: Geocoder
- Extended by:
- Geocoder
- Included in:
- Geocoder
- Defined in:
- lib/geocoder.rb,
lib/geocoder/railtie.rb,
lib/geocoder/request.rb,
lib/geocoder/orms/base.rb,
lib/geocoder/calculations.rb,
lib/geocoder/lookups/base.rb,
lib/geocoder/results/base.rb,
lib/geocoder/configuration.rb
Defined Under Namespace
Modules: Calculations, Lookup, ModelMethods, Orm, Request, Result Classes: Configuration, ConfigurationError, Error, Railtie
Instance Method Summary collapse
-
#address(latitude, longitude) ⇒ Object
Look up the address of the given coordinates.
-
#coordinates(address) ⇒ Object
Look up the coordinates of the given street or IP address.
-
#search(*args) ⇒ Object
Search for information about an address or a set of coordinates.
Instance Method Details
#address(latitude, longitude) ⇒ Object
Look up the address of the given coordinates.
30 31 32 33 34 |
# File 'lib/geocoder.rb', line 30 def address(latitude, longitude) if result = search(latitude, longitude) result.address end end |
#coordinates(address) ⇒ Object
Look up the coordinates of the given street or IP address.
21 22 23 24 25 |
# File 'lib/geocoder.rb', line 21 def coordinates(address) if result = search(address) result.coordinates end end |
#search(*args) ⇒ Object
Search for information about an address or a set of coordinates.
12 13 14 15 16 |
# File 'lib/geocoder.rb', line 12 def search(*args) return nil if blank_query?(args[0]) ip = (args.size == 1 and ip_address?(args.first)) lookup(ip).search(*args) end |