geospatial 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ee2c24c3dbccd264f68b61b60ac34e96a6fa7c1
4
- data.tar.gz: 9b08372743682db4ec05e6b4d7e27913ab0d5f87
3
+ metadata.gz: f680a683a9711ab54aa842e366d8bcf331201221
4
+ data.tar.gz: c9a05d601b5e06486bdcf5a387ebcdeb3c771ec9
5
5
  SHA512:
6
- metadata.gz: c0c6c0d19786014b9f6cb5da18e31a2c00c4248240326e1b1a28870e6b80a0f903ad75781a0b2553ed7c1420bd1590db43fb9fb1124ce8fcc335763ef77509ba
7
- data.tar.gz: aafcf7bfeb1171e973f86844ae8d87a8f94104f94cbe733bb0762890aa1c59aa205260a984e4e0cf54b55f6a963e2b401cd5eb6b53416c2eb49259bbaef7cbe1
6
+ metadata.gz: ffb91f9ce99d727800906b8781b378753b508c16b54bac52f4fd6bcd0b51fd1a1467728d82b20ca18c2905e2c36fba31b10975512dde2dc60dd8f24f2350a904
7
+ data.tar.gz: fb3e122187a2d047485253e90db1e19acd6b0d2667f331fd17326034c98f2483c01b6fe6c5e9929f9e0839d67c89c483b38095a5570d6fcf3ded6485b39945bc
@@ -21,6 +21,8 @@
21
21
  module Geospatial
22
22
  # This location is specifically relating to a WGS84 coordinate on Earth.
23
23
  class Distance
24
+ include Comparable
25
+
24
26
  # Distance in meters:
25
27
  def initialize(value)
26
28
  @value = value
@@ -76,5 +78,9 @@ module Geospatial
76
78
  def == other
77
79
  @value == other.to_f
78
80
  end
81
+
82
+ def <=> other
83
+ @value <=> other.to_f
84
+ end
79
85
  end
80
86
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Geospatial
22
- VERSION = "1.1.3"
22
+ VERSION = "1.2.0"
23
23
  end
@@ -44,4 +44,9 @@ RSpec.describe Geospatial::Distance.new(10000) do
44
44
  it "can subtract distances" do
45
45
  expect(subject - 100).to be == 9900.0
46
46
  end
47
+
48
+ it "can sort distances" do
49
+ expect([subject, subject*2, subject*3].min).to be == subject
50
+ expect([subject, subject*2, subject*3].max).to be == (subject*3)
51
+ end
47
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geospatial
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-31 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec