polylines 0.3.0 → 0.4.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
- SHA1:
3
- metadata.gz: 0237e7cc9473d7cf8379bd047914dd7e28b044bf
4
- data.tar.gz: a1a78b14f27af757e05841e4ee14ace6c8d368e1
2
+ SHA256:
3
+ metadata.gz: da58528bb3a57978f8dc73763bcebd2dd09d64cac7f6c64f6dffc33cdcc9a1c1
4
+ data.tar.gz: a0869fe420b3721e367374e163c2b396655efbb47b1a6c50b8864943a162a191
5
5
  SHA512:
6
- metadata.gz: 6fc953efe71e70921b55a2dea01a25f450e13602a0647b0b5ac6519ac92e449246bd40bbdccef086bb028f41dccab9cdc5b2d3f7fc19f8d84cc8a885863f4ae7
7
- data.tar.gz: 5d5f51ee3a2f3d1b6d14716184887607789e139520b6d83f804147d3a4058115e7828e9bd8ea77134c69cbd8d1c822c40d14547a348ebfedf3eabb1db0d71b8a
6
+ metadata.gz: b8745bf6f073c0894590884508f587448fdda56a9e24e8c2a09649f7477cd2eab1602e85c2754eb43242e43bc7748d8eb703aa948d68c9959ac546f7363dbe42
7
+ data.tar.gz: 9dc0c56d23b52261c03443a6f0b9a1a6e96fcb2c7f5b20ff1246853e69370c0fea4d1a35614a95deaccdb6f5a125fc8f4bb165f459da55f4c41a2074b950ae70
@@ -1,21 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- polylines (0.3.0)
4
+ polylines (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.1.2)
9
+ diff-lcs (1.4.4)
10
10
  rake (10.0.2)
11
- rspec (2.4.0)
12
- rspec-core (~> 2.4.0)
13
- rspec-expectations (~> 2.4.0)
14
- rspec-mocks (~> 2.4.0)
15
- rspec-core (2.4.0)
16
- rspec-expectations (2.4.0)
17
- diff-lcs (~> 1.1.2)
18
- rspec-mocks (2.4.0)
11
+ rspec (3.10.0)
12
+ rspec-core (~> 3.10.0)
13
+ rspec-expectations (~> 3.10.0)
14
+ rspec-mocks (~> 3.10.0)
15
+ rspec-core (3.10.0)
16
+ rspec-support (~> 3.10.0)
17
+ rspec-expectations (3.10.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.10.0)
20
+ rspec-mocks (3.10.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.10.0)
23
+ rspec-support (3.10.0)
19
24
 
20
25
  PLATFORMS
21
26
  ruby
@@ -23,4 +28,7 @@ PLATFORMS
23
28
  DEPENDENCIES
24
29
  polylines!
25
30
  rake
26
- rspec (= 2.4.0)
31
+ rspec (= 3.10.0)
32
+
33
+ BUNDLED WITH
34
+ 2.1.4
@@ -7,7 +7,7 @@ module Polylines
7
7
  [].tap do |points|
8
8
  points << [points_with_deltas.shift, points_with_deltas.shift]
9
9
 
10
- while points_with_deltas.any?
10
+ while points_with_deltas.size > 1
11
11
  points << [
12
12
  points.last[0] + points_with_deltas.shift,
13
13
  points.last[1] + points_with_deltas.shift
@@ -1,3 +1,3 @@
1
1
  module Polylines
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -16,6 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_development_dependency("rspec", "2.4.0")
19
+ s.add_development_dependency("rspec", "3.10.0")
20
20
  s.add_development_dependency("rake")
21
21
  end
@@ -2,38 +2,52 @@ require "spec_helper"
2
2
 
3
3
  describe Polylines::Decoder, ".decode" do
4
4
  it "decodes a single point" do
5
- Polylines::Decoder.decode("`~oia@").should be_within(0.00001).of(-179.9832104)
5
+ expect(Polylines::Decoder.decode("`~oia@")).to be_within(0.00001).of(-179.9832104)
6
6
  end
7
7
 
8
8
  it "decodes a single point with 1e6 precision" do
9
- Polylines::Decoder.decode("ruhhvI", 1e6).should be_within(0.000001).of(-179.9832104)
9
+ expect(Polylines::Decoder.decode("ruhhvI", 1e6)).to be_within(0.000001).of(-179.9832104)
10
10
  end
11
11
  end
12
12
 
13
13
  describe Polylines::Decoder, ".decode_polyline" do
14
- let(:points) { [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]] }
14
+ let(:points) { [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]] }
15
15
 
16
16
  context "with default precision" do
17
- let(:polyline) { "_p~iF~ps|U_ulLnnqC_mqNvxq`@" }
18
17
  it "decodes a polyline correctly" do
19
- Polylines::Decoder.decode_polyline(polyline).should == points
18
+ polyline = "_p~iF~ps|U_ulLnnqC_mqNvxq`@"
19
+
20
+ expect(Polylines::Decoder.decode_polyline(polyline)).to eq points
20
21
  end
21
22
  end
22
23
 
23
24
  context "with 1e6 precision" do
24
- let(:polyline) { "_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI" }
25
25
  it "decodes a polyline correctly" do
26
- Polylines::Decoder.decode_polyline(polyline, 1e6).should == points
26
+ polyline = "_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI"
27
+
28
+ expect(Polylines::Decoder.decode_polyline(polyline, 1e6)).to eq points
27
29
  end
28
30
  end
29
31
  end
30
32
 
31
33
  describe Polylines::Decoder, ".decode_polyline with points that were close together" do
32
34
  it "decodes a polyline correctly" do
33
- Polylines::Decoder.decode_polyline("krk{FdxdlO?e@").should == [[41.35222, -86.04563],[41.35222, -86.04544]]
35
+ points = [[41.35222, -86.04563], [41.35222, -86.04544]]
36
+
37
+ expect(Polylines::Decoder.decode_polyline("krk{FdxdlO?e@")).to eq points
34
38
  end
35
39
 
36
40
  it "decodes a polyline correctly with 1e6 precision" do
37
- Polylines::Decoder.decode_polyline("q`}zmAzzxbcD?aK", 1e6).should == [[41.352217, -86.045630],[41.352217, -86.045437]]
41
+ points = [[41.352217, -86.045630], [41.352217, -86.045437]]
42
+
43
+ expect(Polylines::Decoder.decode_polyline("q`}zmAzzxbcD?aK", 1e6)).to eq points
44
+ end
45
+ end
46
+
47
+ describe Polylines::Decoder, ".decode_polyline with a value that previously broke" do
48
+ it "decodes a polyline correctly" do
49
+ value = "kbdoH{ioqCoF_j@Lwc@lC{BhNoMzCuJbEm]?wKkBaQmD}EqM_GwFiBfCge@zE_K~SaTdT`L|Da\\\\xJsX|EyJtQgPpXuRjKAtJqBfM[pn@g^nF}G??"
50
+
51
+ expect(Polylines::Decoder.decode_polyline(value).length).to eq 27
38
52
  end
39
53
  end
@@ -2,44 +2,52 @@ require "spec_helper"
2
2
 
3
3
  describe Polylines::Encoder, ".encode" do
4
4
  it "encodes a single point" do
5
- Polylines::Encoder.encode(-179.9832104).should == "`~oia@"
5
+ expect(Polylines::Encoder.encode(-179.9832104)).to eq "`~oia@"
6
6
  end
7
7
 
8
8
  it "encodes a single point with 1e6 precision" do
9
- Polylines::Encoder.encode(-179.9832104, 1e6).should == "ruhhvI"
9
+ expect(Polylines::Encoder.encode(-179.9832104, 1e6)).to eq "ruhhvI"
10
10
  end
11
11
  end
12
12
 
13
13
  describe Polylines::Encoder, ".encode_points" do
14
- let(:points) { [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]] }
14
+ let(:points) { [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]] }
15
15
 
16
16
  context "with default precision" do
17
- let(:polyline) { "_p~iF~ps|U_ulLnnqC_mqNvxq`@" }
18
17
  it "encodes points correctly" do
19
- Polylines::Encoder.encode_points(points).should == polyline
18
+ polyline = "_p~iF~ps|U_ulLnnqC_mqNvxq`@"
19
+
20
+ expect(Polylines::Encoder.encode_points(points)).to eq polyline
20
21
  end
21
22
  end
22
23
 
23
24
  context "with 1e6 precsion" do
24
- let(:polyline) { "_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI" }
25
25
  it "encodes points correctly" do
26
- Polylines::Encoder.encode_points(points, 1e6).should == polyline
26
+ polyline = "_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI"
27
+
28
+ expect(Polylines::Encoder.encode_points(points, 1e6)).to eq polyline
27
29
  end
28
30
  end
29
31
  end
30
32
 
31
33
  describe Polylines::Encoder, ".encode_points that are very close together" do
32
34
  it "encodes points correctly" do
33
- Polylines::Encoder.encode_points([[41.3522171071184, -86.0456299662023],[41.3522171071183, -86.0454368471533]]).should == "krk{FdxdlO?e@"
35
+ points = [[41.3522171071184, -86.0456299662023], [41.3522171071183, -86.0454368471533]]
36
+
37
+ expect(Polylines::Encoder.encode_points(points)).to eq "krk{FdxdlO?e@"
34
38
  end
35
39
 
36
40
  it "encodes points correctly with 1e6 precision" do
37
- Polylines::Encoder.encode_points([[41.3522171071184, -86.0456299662023],[41.3522171071183, -86.0454368471533]], 1e6).should == "q`}zmAzzxbcD?aK"
41
+ points = [[41.3522171071184, -86.0456299662023], [41.3522171071183, -86.0454368471533]]
42
+
43
+ expect(Polylines::Encoder.encode_points(points, 1e6)).to eq "q`}zmAzzxbcD?aK"
38
44
  end
39
45
  end
40
46
 
41
47
  describe Polylines::Encoder, ".encode_points with same results as google's api" do
42
48
  it "encodes without rounding errors" do
43
- Polylines::Encoder.encode_points([[39.13594499,-94.4243478],[39.13558757,-94.4243471]]).should == "svzmFdgi_QdA?"
49
+ points = [[39.13594499,-94.4243478], [39.13558757,-94.4243471]]
50
+
51
+ expect(Polylines::Encoder.encode_points(points)).to eq "svzmFdgi_QdA?"
44
52
  end
45
- end
53
+ end
@@ -1,7 +1,3 @@
1
1
  require "rubygems"
2
2
  require "bundler/setup"
3
-
4
3
  require "polylines"
5
- #
6
- # RSpec.configure do |config|
7
- # end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polylines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Clayton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2020-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.0
19
+ version: 3.10.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.0
26
+ version: 3.10.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -78,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
80
  requirements: []
81
- rubyforge_project:
82
- rubygems_version: 2.4.5
81
+ rubygems_version: 3.1.4
83
82
  signing_key:
84
83
  specification_version: 4
85
84
  summary: Easily handle Google polylines
@@ -87,4 +86,3 @@ test_files:
87
86
  - spec/polylines/decoder_spec.rb
88
87
  - spec/polylines/encoder_spec.rb
89
88
  - spec/spec_helper.rb
90
- has_rdoc: