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

Consolidate point argument explanation.

parent 5986e1cd
No related branches found
No related tags found
No related merge requests found
...@@ -18,8 +18,14 @@ module Geocoder ...@@ -18,8 +18,14 @@ module Geocoder
## ##
# Calculate the distance from the object to an arbitrary point. # Calculate the distance from the object to an arbitrary point.
# Takes two floats (latitude, longitude) and a symbol specifying the # The point can be:
# units to be used (:mi or :km; default is :mi). #
# * an array of coordinates ([lat,lon])
# * a geocoded object (one which implements a +to_coordinates+ method
# which returns a [lat,lon] array
# * a geocodable address (string)
#
# Also takes a symbol specifying the units (:mi or :km; default is :mi).
# #
def distance_to(point, *args) def distance_to(point, *args)
return nil unless geocoded? return nil unless geocoded?
...@@ -35,12 +41,7 @@ module Geocoder ...@@ -35,12 +41,7 @@ module Geocoder
## ##
# Calculate the bearing from the object to another point. # Calculate the bearing from the object to another point.
# The point can be: # See distance_to for various ways to specify the point.
#
# * an array of coordinates ([lat,lon])
# * a geocoded object (one which implements a +to_coordinates+ method
# which returns a [lat,lon] array
# * a geocodable address (string)
# #
def bearing_to(point, options = {}) def bearing_to(point, options = {})
return nil unless them = Geocoder::Calculations.extract_coordinates(point) return nil unless them = Geocoder::Calculations.extract_coordinates(point)
...@@ -51,7 +52,7 @@ module Geocoder ...@@ -51,7 +52,7 @@ module Geocoder
## ##
# Calculate the bearing from another point to the object. # Calculate the bearing from another point to the object.
# See bearing_to for details. # See distance_to for various ways to specify the point.
# #
def bearing_from(point, options = {}) def bearing_from(point, options = {})
return nil unless them = Geocoder::Calculations.extract_coordinates(point) return nil unless them = Geocoder::Calculations.extract_coordinates(point)
......
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