geospatial 1.8.0 → 1.9.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/geospatial/location.rb +10 -0
- data/lib/geospatial/version.rb +1 -1
- data/spec/geospatial/location_spec.rb +5 -0
- 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: d26cdfa5dc37ae8c5babc8fe2f9b75de730d8a77457eeedfd46e19fd78c26cf2
|
4
|
+
data.tar.gz: 87f0287c0c44849e126ed8787342d29bec1d234f53aa4e3a10ed2e211cc1f9c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d18d27fae0ff6effafa7113c95d6a85716b92c0f0c5e228bb5e32e089f2846f46086790e0800f3aabfc4abee36d4e0e58ad5f0b8b24634153e70e652301049
|
7
|
+
data.tar.gz: d77dd4410904c5dc17f0226fd226cec6c394d8fbf291e6cbfc068a167e2b551e2d64b5411d4e20c05c59639ca63efbccc84b559de35dff69a589fc9639b0509b
|
data/lib/geospatial/location.rb
CHANGED
@@ -87,10 +87,20 @@ module Geospatial
|
|
87
87
|
to_a
|
88
88
|
end
|
89
89
|
|
90
|
+
def to_h
|
91
|
+
{latitude: @latitude, longitude: @longitude}
|
92
|
+
end
|
93
|
+
|
90
94
|
def to_s
|
91
95
|
"#{self.class}[#{self.longitude.to_f}, #{self.latitude.to_f}]"
|
92
96
|
end
|
93
97
|
|
98
|
+
include Comparable
|
99
|
+
|
100
|
+
def <=> other
|
101
|
+
to_a <=> other.to_a
|
102
|
+
end
|
103
|
+
|
94
104
|
alias inspect to_s
|
95
105
|
|
96
106
|
attr :longitude # -180 -> 180 (equivalent to x)
|
data/lib/geospatial/version.rb
CHANGED
@@ -32,6 +32,11 @@ RSpec.describe Geospatial::Location do
|
|
32
32
|
it "should format nicely" do
|
33
33
|
expect("#{lake_alex}").to be == "Geospatial::Location[170.45, -43.94]"
|
34
34
|
end
|
35
|
+
|
36
|
+
it "should have equivalence" do
|
37
|
+
expect(lake_tekapo).to be == lake_tekapo
|
38
|
+
expect(lake_alex).to_not be == lake_tekapo
|
39
|
+
end
|
35
40
|
end
|
36
41
|
|
37
42
|
context 'points on equator' do
|