From 712d6cc02709b87d60229b12ecaaa2f98038b29f Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Fri, 1 Apr 2011 09:44:33 -0400 Subject: [PATCH] Change variable name. This reduces the desire to use map! (instead of map) which would modify the user's argument in-place. There's a test to prevent that but this makes sense semantically too. --- lib/geocoder/calculations.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/geocoder/calculations.rb b/lib/geocoder/calculations.rb index 83cf25dd..418d84d0 100644 --- a/lib/geocoder/calculations.rb +++ b/lib/geocoder/calculations.rb @@ -118,11 +118,11 @@ module Geocoder def geographic_center(points) # convert objects to [lat,lon] arrays and convert degrees to radians - points = points.map{ |p| to_radians(extract_coordinates(p)) } + coords = points.map{ |p| to_radians(extract_coordinates(p)) } # convert to Cartesian coordinates x = []; y = []; z = [] - points.each do |p| + coords.each do |p| x << Math.cos(p[0]) * Math.cos(p[1]) y << Math.cos(p[0]) * Math.sin(p[1]) z << Math.sin(p[0]) -- GitLab