From fc0b5ba901231d41d1dc89de47ef17d1feda8966 Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Tue, 3 Nov 2009 16:57:52 -0500
Subject: [PATCH] Include Math module.

---
 lib/geocoder.rb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/geocoder.rb b/lib/geocoder.rb
index cc9d64bc..bf0b1f4a 100644
--- a/lib/geocoder.rb
+++ b/lib/geocoder.rb
@@ -2,6 +2,7 @@
 # Add geocoding functionality (via Google) to any object.
 #
 module Geocoder
+  include Math
   
   ##
   # Implementation of 'included' hook method.
@@ -207,9 +208,9 @@ module Geocoder
     dlat = (lat1 - lat2).abs
     dlon = (lon1 - lon2).abs
     
-    a = (Math.sin(dlat / 2))**2 + Math.cos(lat1) *
-        (Math.sin(dlon / 2))**2 * Math.cos(lat2)  
-    c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a))  
+    a = (sin(dlat / 2))**2 + cos(lat1) *
+        (sin(dlon / 2))**2 * cos(lat2)  
+    c = 2 * atan2( sqrt(a), sqrt(1-a))  
     c * units[options[:units]]
   end
   
@@ -217,7 +218,7 @@ module Geocoder
   # Convert degrees to radians.
   #
   def self.to_radians(degrees)
-    degrees * (Math::PI / 180)
+    degrees * (PI / 180)
   end
   
   ##
-- 
GitLab