From 657ebcc54e84eb84b39541d2fe08dfe6b910641f Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Thu, 24 Mar 2011 13:40:27 -0400
Subject: [PATCH] Extend to_degrees to convert an entire array.

---
 lib/geocoder/calculations.rb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/geocoder/calculations.rb b/lib/geocoder/calculations.rb
index 77c47449..dcf8971a 100644
--- a/lib/geocoder/calculations.rb
+++ b/lib/geocoder/calculations.rb
@@ -116,9 +116,15 @@ module Geocoder
 
     ##
     # Convert radians to degrees.
+    # If an array is passed, converts each value and returns array.
     #
-    def to_degrees(radians)
-      (radians * 180.0) / Math::PI
+    def to_degrees(*args)
+      args = args.first if args.first.is_a?(Array)
+      if args.size == 1
+        (args.first * 180.0) / Math::PI
+      else
+        args.map{ |i| to_degrees(i) }
+      end
     end
 
     ##
-- 
GitLab