mongoid-geospatial 7.3.1 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mongoid/geospatial/fields/point.rb +13 -0
- data/lib/mongoid/geospatial/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3fe8fdb16899dedfb2b332791e86caff0a6263e6a973ac9460e6b167f2540edb
|
|
4
|
+
data.tar.gz: 00a8663771fb673841e1addfcf7add390269982d1c1468f34cc77e73fda36428
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 179a915b32d8a20386adefbcb040681b49c53139970a68a8965089b7117a67f456b70cd3b3266c4a224225d374bf2710679dc9125ea11e45c489b3cc0de2458d
|
|
7
|
+
data.tar.gz: 6390574b2c40e723b138824f2af1b98491c61d4b5aa87ae26bfd8dfa0407d93164cf6eb03897a278c939ae9db4f4b5d77a8f8861b1e963aa4bb5587c83316fbe
|
|
@@ -34,6 +34,19 @@ module Mongoid
|
|
|
34
34
|
alias to_xy mongoize
|
|
35
35
|
alias to_lng_lat mongoize
|
|
36
36
|
|
|
37
|
+
# Two points are the same spot when they hold the same pair. Without
|
|
38
|
+
# this, `==` was object identity (Enumerable does not bring one), so a
|
|
39
|
+
# point loaded twice never equalled itself: `place.geom == city.geom`
|
|
40
|
+
# was false for the very same [x, y]. Only a Point equals a Point —
|
|
41
|
+
# `to_a` is the door to compare with an Array. z is not stored (see
|
|
42
|
+
# #mongoize), so it does not take part.
|
|
43
|
+
def ==(other)
|
|
44
|
+
other.is_a?(Point) && mongoize == other.mongoize
|
|
45
|
+
end
|
|
46
|
+
alias eql? ==
|
|
47
|
+
|
|
48
|
+
def hash = [Point, mongoize].hash
|
|
49
|
+
|
|
37
50
|
def [](args)
|
|
38
51
|
raise ArgumentError, "Invalid point: #{inspect}" unless (pair = mongoize)
|
|
39
52
|
|