From d7b479f047ca3f69bc1b6e5db356e6ce6f96ba71 Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Thu, 16 Apr 2009 00:33:56 -0400 Subject: [PATCH] Improve in-code comments. --- lib/geocoder.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/geocoder.rb b/lib/geocoder.rb index df03e5a5..bbdb5460 100644 --- a/lib/geocoder.rb +++ b/lib/geocoder.rb @@ -8,7 +8,7 @@ module Geocoder ## # Query Google for the coordinates of the given phrase. - # Returns array [lat,lon] if found. + # Returns array [lat,lon] if found, nil if not found or if network error. # def self.fetch_coordinates(query) data = self.search(query) @@ -32,7 +32,8 @@ module Geocoder end ## - # Search Google based on the object's +location+ attribute. + # Fetch coordinates based on the object's object's +location+. Returns an + # array <tt>[lat,lon]</tt>. # def fetch_coordinates(attribute = :location) Geocoder.fetch_coordinates(send(attribute)) @@ -49,7 +50,10 @@ module Geocoder end ## - # Calculate the distance between two points (Haversine formula). + # Calculate the distance between two points (Haversine formula). Takes two + # sets of coordinates and an options hash: + # + # :units : <tt>:mi</tt> for miles (default), <tt>:km</tt> for kilometers # def self.distance_between(lat1, lon1, lat2, lon2, options = {}) # set default options -- GitLab