fast-polylines 2.2.0 → 2.2.2

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
  SHA256:
3
- metadata.gz: 0ab14d087b6992d7abec3047ad38aea4e7474f4bfff06b921ea91699bd788172
4
- data.tar.gz: 4225fc53ff0801e6b145058461d9cf6d5f65be902787a7496e85c83883b52ba5
3
+ metadata.gz: fd26a9400977f70c17d07fbbc97484bc33fa5c2a876ec72739379b9650b00403
4
+ data.tar.gz: b2caa0bcaa90d269bd92b948b01ecc080c006a1304500edd1435513671a2b465
5
5
  SHA512:
6
- metadata.gz: 82f43939d565a422fdf0696539f1c668d851aa88ff36d52a9f3ad2d909ebfe095c1ccd0b7266243943c834f70dc5c954c85715a3c435768df2c6ccce871443b4
7
- data.tar.gz: 97ab65e7683ecbb53bf5673532e5ff99399b7f0b97b140221127b302e2d54020c1e3b1b6c174a624c49d276801b0f76089e3378cf5949b7a8fdad64494d89db0
6
+ metadata.gz: 7fb523730effba875e1eb7f557904bfdf11f44e419cbea433f11d29c73587b29956339075ac3b6af8f7e83de2a5b17241d93bb806f703a69f2ca81ff439fcd2a
7
+ data.tar.gz: 4311f966e39d44e47fd039712549466fa29a828f7470e5c33238f8997540f95327e2befd182bc79ceebfe9c5c728e001a41cd57ab7250ea80b676023a3a8913f
data/.yardopts ADDED
@@ -0,0 +1,7 @@
1
+ --markup markdown
2
+ --output-dir ./yardoc
3
+ lib/**/*.rb
4
+ ext/**/*.c
5
+ -
6
+ README.md
7
+ CHANGELOG.md
data/CHANGELOG.md CHANGED
@@ -13,6 +13,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
13
13
 
14
14
  ### Fixed
15
15
 
16
+ ## [2.2.2] — 2022-01-11
17
+
18
+ ### Added
19
+
20
+ - C API documentation.
21
+
16
22
  ## [2.2.0] — 2020-11-24
17
23
 
18
24
  ### Added
@@ -42,7 +48,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
42
48
  - Broken behavior when approaching the chunk size limit (#16)
43
49
 
44
50
 
45
- [unreleased]: https://github.com/klaxit/fast-polylines/compare/v2.2.0...HEAD
51
+ [unreleased]: https://github.com/klaxit/fast-polylines/compare/v2.2.2...HEAD
52
+ [2.2.2]: https://github.com/klaxit/fast-polylines/compare/v2.2.0...v2.2.2
46
53
  [2.2.0]: https://github.com/klaxit/fast-polylines/compare/v2.1.0...v2.2.0
47
54
  [2.1.0]: https://github.com/klaxit/fast-polylines/compare/v2.0.1...v2.1.0
48
55
  [2.0.1]: https://github.com/klaxit/fast-polylines/compare/v2.0.0...v2.0.1
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Fast Polylines
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/fast-polylines.svg)](https://badge.fury.io/rb/fast-polylines)
4
- [![Build Status](https://travis-ci.org/klaxit/fast-polylines.svg?branch=master)](https://travis-ci.org/klaxit/fast-polylines)
3
+ [![Gem](https://img.shields.io/gem/v/fast-polylines)](https://rubygems.org/gems/fast-polylines)
4
+ [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/klaxit/fast-polylines/Continuous%20Integration)](https://github.com/klaxit/fast-polylines/actions?query=workflow%3A%22Continuous+Integration%22)
5
5
 
6
6
  Implementation of the [Google polyline algorithm][algorithm].
7
7
 
@@ -1,3 +1,24 @@
1
+ /**
2
+ * Document-module: FastPolylines
3
+ *
4
+ * Implementation of the [Google polyline algorithm](https://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html).
5
+ *
6
+ * Install it with `gem install fast-polylines`, and then:
7
+ *
8
+ * require "fast_polylines"
9
+ *
10
+ * FastPolylines.encode([[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]])
11
+ * # "_p~iF~ps|U_ulLnnqC_mqNvxq`@"
12
+ *
13
+ * FastPolylines.decode("_p~iF~ps|U_ulLnnqC_mqNvxq`@")
14
+ * # [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]]
15
+ *
16
+ * You can set an arbitrary precision for your coordinates to be encoded/decoded. It may be from 1
17
+ * to 13 decimal digits. However, 13 may be too much.
18
+ *
19
+ * [![https://xkcd.com/2170/](https://imgs.xkcd.com/comics/coordinate_precision.png)](https://www.explainxkcd.com/wiki/index.php/2170:_Coordinate_Precision)
20
+ */
21
+
1
22
  #include <ruby.h>
2
23
 
3
24
  // An encoded number can have at most _precision_ characters. However,
@@ -46,7 +67,15 @@ static inline uint _get_precision(VALUE value) {
46
67
  return (uint)precision;
47
68
  }
48
69
 
49
- static inline VALUE
70
+ /**
71
+ * call-seq:
72
+ * FastPolylines.decode(polyline, precision = 5) -> [[lat, lng], ...]
73
+ *
74
+ * Decode a polyline to a list of coordinates (lat, lng tuples). You may
75
+ * set an arbitrary coordinate precision, however, it **must match** the precision
76
+ * that was used for encoding.
77
+ */
78
+ static VALUE
50
79
  rb_FastPolylines__decode(int argc, VALUE *argv, VALUE self) {
51
80
  rb_check_arity(argc, 1, 2);
52
81
  Check_Type(argv[0], T_STRING);
@@ -103,7 +132,15 @@ _polyline_encode_number(char *chunks, int64_t number) {
103
132
  return i;
104
133
  }
105
134
 
106
- static inline VALUE
135
+ /**
136
+ * call-seq:
137
+ * FastPolylines.encode([[lat, lng], ...], precision = 5) -> string
138
+ *
139
+ * Encode a list of coordinates to a polyline, you may give a specific precision
140
+ * if you want to retain more (or less) than 5 digits of precision. The maximum
141
+ * is 13, and may really be [too much](https://xkcd.com/2170/).
142
+ */
143
+ static VALUE
107
144
  rb_FastPolylines__encode(int argc, VALUE *argv, VALUE self) {
108
145
  rb_check_arity(argc, 1, 2);
109
146
  Check_Type(argv[0], T_ARRAY);
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastPolylines
4
- VERSION = "2.2.0"
4
+ VERSION = "2.2.2"
5
5
  end
@@ -3,17 +3,19 @@
3
3
  require "fast_polylines/fast_polylines"
4
4
 
5
5
  module FastPolylines::Encoder
6
- module_function def encode(points, precision = 1e5)
6
+ # @deprecated Use {FastPolylines.encode} instead.
7
+ def self.encode(points, precision = 1e5)
7
8
  warn "Deprecated use of `FastPolylines::Encoder.encode`, " \
8
- "use `FastPolylines.encode`."
9
+ "use `FastPolylines.encode`."
9
10
  FastPolylines.encode(points, Math.log10(precision))
10
11
  end
11
12
  end
12
13
 
13
14
  module FastPolylines::Decoder
14
- module_function def decode(polyline, precision = 1e5)
15
+ # @deprecated Use {FastPolylines.decode} instead.
16
+ def self.decode(polyline, precision = 1e5)
15
17
  warn "Deprecated use of `FastPolylines::Decoder.decode`, " \
16
- "use `FastPolylines.decode`."
18
+ "use `FastPolylines.decode`."
17
19
  FastPolylines.decode(polyline, Math.log10(precision))
18
20
  end
19
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast-polylines
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyrille Courtière
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-11-24 00:00:00.000000000 Z
12
+ date: 2022-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: benchmark-ips
@@ -62,6 +62,7 @@ extensions:
62
62
  extra_rdoc_files: []
63
63
  files:
64
64
  - ".rspec"
65
+ - ".yardopts"
65
66
  - CHANGELOG.md
66
67
  - README.md
67
68
  - ext/fast_polylines/extconf.rb
@@ -91,12 +92,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
92
  - !ruby/object:Gem::Version
92
93
  version: '0'
93
94
  requirements: []
94
- rubygems_version: 3.1.2
95
+ rubygems_version: 3.2.3
95
96
  signing_key:
96
97
  specification_version: 4
97
98
  summary: Fast & easy Google polylines
98
99
  test_files:
99
- - spec/spec_helper.rb
100
100
  - spec/fast-polylines_spec.rb
101
101
  - spec/fast_polylines_spec.rb
102
+ - spec/spec_helper.rb
102
103
  - ".rspec"