From dbf358454bbcf4eb646278844112a5788fb050b3 Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Wed, 17 Oct 2012 14:48:47 -0400
Subject: [PATCH] Don't redefine Object#hash method.

This addresses Github issue #318.
---
 lib/geocoder/results/yahoo.rb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/geocoder/results/yahoo.rb b/lib/geocoder/results/yahoo.rb
index fab775c5..6c11b49c 100644
--- a/lib/geocoder/results/yahoo.rb
+++ b/lib/geocoder/results/yahoo.rb
@@ -31,6 +31,10 @@ module Geocoder::Result
       @data['postal']
     end
 
+    def address_hash
+      @data['hash']
+    end
+
     def self.response_attributes
       %w[quality offsetlat offsetlon radius boundingbox name
         line1 line2 line3 line4 cross house street xstreet unittype unit
@@ -40,8 +44,10 @@ module Geocoder::Result
     end
 
     response_attributes.each do |a|
-      define_method a do
-        @data[a]
+      unless method_defined?(a)
+        define_method a do
+          @data[a]
+        end
       end
     end
   end
-- 
GitLab