simple-trail 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple_trail/manipulation/enricher.rb +4 -3
- data/simple-trail.gemspec +1 -1
- data/spec/manipulation/enricher_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d608b96acfb85c52f3fc307cd4e192323409b9751b0a9cc63a0186aba7e3e000
|
4
|
+
data.tar.gz: 4e93f997eb2729fc3bcb39e0d554febb6414e794fd7c8f5ebdfc4f53769687cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f6d82618ceff0384f5b8238ab571831ba77ef69732a8761ad81e53050c02195349a400259bec1a86f6491a26e0d9ef33b01af5c991193e0956a56cdd10b9bc0
|
7
|
+
data.tar.gz: 98789cedfb83d67f74c11646d021bc2087480ad26a9047f32b45aad271491ca8142cab1540a771ca1540f8905041d91fd722bb75e8dcb4c00f433dfee765dfdd
|
@@ -75,17 +75,18 @@ module Manipulation
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def add_km_markers
|
78
|
-
total_distance = @points[-1][:total_distance].floor
|
78
|
+
total_distance = @points[-1][:total_distance].floor
|
79
79
|
start_v = @offset.to_f.ceil
|
80
80
|
|
81
81
|
(start_v..start_v+total_distance).each do |i|
|
82
|
-
|
82
|
+
next if i == @offset.to_f
|
83
|
+
find_and_enrich_first_occurence(i)
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
86
87
|
def find_and_enrich_first_occurence(i)
|
87
88
|
index = @points.find_index{|point| point[:total_distance] + @offset.to_f > i}
|
88
|
-
@points[index].merge!(label: i)
|
89
|
+
@points[index].merge!(label: i) if index
|
89
90
|
end
|
90
91
|
|
91
92
|
def calculate_distance(loc1, loc2)
|
data/simple-trail.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'simple-trail'
|
8
|
-
s.version = '0.2.
|
8
|
+
s.version = '0.2.6'
|
9
9
|
s.date = '2020-08-03'
|
10
10
|
s.summary = 'Readind and manipulating GPX and other trail representation file'
|
11
11
|
s.description = 'Optimazing and manipulating GPX file data. For my private purposes mostly'
|
@@ -47,6 +47,8 @@ RSpec.describe Manipulation::Enricher do
|
|
47
47
|
labels = enrichement_logic.enriched_points.map{|h| h[:label]}.compact.uniq
|
48
48
|
expect(labels.size).to eq 506
|
49
49
|
expect(labels.include?(1)).to be(true)
|
50
|
+
expect(labels.include?(506)).to be(true)
|
51
|
+
expect(labels.include?(507)).to be(false)
|
50
52
|
expect(labels.include?(535)).to be(false)
|
51
53
|
end
|
52
54
|
|
@@ -59,6 +61,8 @@ RSpec.describe Manipulation::Enricher do
|
|
59
61
|
labels = enrichement_logic.enriched_points.map{|h| h[:label]}.compact.uniq
|
60
62
|
expect(labels.size).to eq 506
|
61
63
|
expect(labels.include?(1)).to be(false)
|
62
|
-
expect(labels.include?(
|
64
|
+
expect(labels.include?(50)).to be(false)
|
65
|
+
expect(labels.include?(51)).to be(true)
|
66
|
+
expect(labels.include?(556)).to be(true)
|
63
67
|
end
|
64
68
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-trail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Staszek Zawadzki
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
147
|
+
rubygems_version: 3.3.7
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Readind and manipulating GPX and other trail representation file
|