opium 1.3.4 → 1.3.5
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/CHANGELOG.md +4 -0
- data/lib/opium/extensions/geo_point.rb +5 -1
- data/lib/opium/version.rb +1 -1
- data/spec/opium/extensions/geo_point_spec.rb +28 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba3e984219298d9044d897b69174d070e97203ea
|
4
|
+
data.tar.gz: a75539396c4cf16ce7663a6cb2aa0014cf7a5284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01cb3c6a85d9b7164453c422ce2c760a0f30fe16d5130275acc95499e9684c7d7aaeedb39df18241752609c150fd2a5a8bed52f1e5bdb476d06f0ff96d2f3269
|
7
|
+
data.tar.gz: 0592a85febebccaae06eb14d3688d3cb33809d6ba185ff481b76b54c6c9b57f26726f53509e16ac4a763420a60390e9bf5716671a90519873c31849056fb43c4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.3.5
|
2
|
+
### New Features
|
3
|
+
- Due to ignorance, missed a method override for Opium::GeoPoint ===. Now implemented at the class level as well as at the instance level.
|
4
|
+
|
1
5
|
## 1.3.4
|
2
6
|
### New Features
|
3
7
|
- Opium::GeoPoint now provides a custom === operator; this either delegates to == (if given another geo point), to != (if given GeoPoint; NULL_ISLAND is an invalid location!), or nil if anything else.
|
@@ -39,7 +39,7 @@ module Opium
|
|
39
39
|
if other.is_a? self.class
|
40
40
|
self == other
|
41
41
|
elsif other <= self.class
|
42
|
-
self != NULL_ISLAND
|
42
|
+
self != NULL_ISLAND
|
43
43
|
else
|
44
44
|
nil
|
45
45
|
end
|
@@ -48,6 +48,10 @@ module Opium
|
|
48
48
|
NULL_ISLAND = new( [0, 0] ).freeze
|
49
49
|
|
50
50
|
class << self
|
51
|
+
def ===( other )
|
52
|
+
other != NULL_ISLAND && super
|
53
|
+
end
|
54
|
+
|
51
55
|
def to_ruby(object)
|
52
56
|
object.to_geo_point unless object.nil?
|
53
57
|
end
|
data/lib/opium/version.rb
CHANGED
@@ -101,6 +101,34 @@ describe Opium::GeoPoint do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
describe '#===' do
|
105
|
+
let(:result) { described_class === a }
|
106
|
+
|
107
|
+
context 'with a real location' do
|
108
|
+
let(:a) { described_class.new( [1, 1] ) }
|
109
|
+
|
110
|
+
it { expect( result ).to eq true }
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'with NULL_ISLAND' do
|
114
|
+
let(:a) { described_class::NULL_ISLAND }
|
115
|
+
|
116
|
+
it { expect( result ).to be_falsy }
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'with nil' do
|
120
|
+
let(:a) { nil }
|
121
|
+
|
122
|
+
it { expect( result ).to be_falsy }
|
123
|
+
end
|
124
|
+
|
125
|
+
context 'with non geo data' do
|
126
|
+
let(:a) { 23 }
|
127
|
+
|
128
|
+
it { expect( result ).to be_falsy }
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
104
132
|
describe '.===' do
|
105
133
|
let(:result) { a === described_class }
|
106
134
|
|