Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of git://github.com/weplay/geokit-gem into wepl…

…ay/master
  • Loading branch information...
commit 6997c98231d20b074ae1d586f9471e44f6c00b2d 2 parents d14ed04 + 91fb215
Andre Lewis authored April 05, 2009
8  lib/geokit/mappable.rb
@@ -251,6 +251,14 @@ def ==(other)
251 251
       other.is_a?(LatLng) ? self.lat == other.lat && self.lng == other.lng : false
252 252
     end
253 253
     
  254
+    def hash
  255
+      lat.hash + lng.hash
  256
+    end
  257
+    
  258
+    def eql?(other)
  259
+      self == other
  260
+    end
  261
+    
254 262
     # A *class* method to take anything which can be inferred as a point and generate
255 263
     # a LatLng from it. You should use this anything you're not sure what the input is,
256 264
     # and want to deal with it as a LatLng if at all possible. Can take:
18  test/test_latlng.rb
@@ -128,5 +128,21 @@ def test_normalize
128 128
     res=Geokit::LatLng.normalize([lat,lng])
129 129
     assert_equal res,Geokit::LatLng.new(lat,lng)
130 130
   end
131  
-    
  131
+  
  132
+  def test_hash
  133
+    lat=37.7690
  134
+    lng=-122.443
  135
+    first = Geokit::LatLng.new(lat,lng)
  136
+    second = Geokit::LatLng.new(lat,lng)
  137
+    assert_equal first.hash, second.hash
  138
+  end
  139
+  
  140
+  def test_eql?
  141
+    lat=37.7690
  142
+    lng=-122.443
  143
+    first = Geokit::LatLng.new(lat,lng)
  144
+    second = Geokit::LatLng.new(lat,lng)
  145
+    assert first.eql?(second)
  146
+    assert second.eql?(first)
  147
+  end
132 148
 end

0 notes on commit 6997c98

Please sign in to comment.
Something went wrong with that request. Please try again.