tf1_converter 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/tf1_converter/gpx/track.rb +8 -3
- data/lib/tf1_converter/version.rb +1 -1
- data/spec/lib/tf1_converter/gpx/track_spec.rb +20 -0
- metadata +6 -4
data/Gemfile.lock
CHANGED
@@ -3,8 +3,9 @@ require_relative 'trackpoint'
|
|
3
3
|
module TF1Converter
|
4
4
|
module Gpx
|
5
5
|
class Track
|
6
|
-
def initialize(xml_node)
|
6
|
+
def initialize(xml_node, color_map = TF1Converter::Config.colors)
|
7
7
|
@node = xml_node
|
8
|
+
@color_map = color_map
|
8
9
|
end
|
9
10
|
|
10
11
|
def name
|
@@ -12,8 +13,12 @@ module TF1Converter
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def display_color
|
15
|
-
|
16
|
-
|
16
|
+
color_node = @node.xpath('extensions/TrackExtension/DisplayColor').first
|
17
|
+
if color_node
|
18
|
+
@color_map[color_node.text]
|
19
|
+
else
|
20
|
+
'f0000080'
|
21
|
+
end
|
17
22
|
end
|
18
23
|
|
19
24
|
def coordinate_string
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative '../../../../lib/tf1_converter/gpx/track'
|
2
|
+
|
3
|
+
module TF1Converter::Gpx
|
4
|
+
describe Track do
|
5
|
+
describe '#display_color' do
|
6
|
+
it 'gets the mapped color name from the config' do
|
7
|
+
color_map = {'Orange' => 'aabbccdd' }
|
8
|
+
node = double(xpath: double(first: double(text: 'Orange')))
|
9
|
+
track = Track.new(node, color_map)
|
10
|
+
track.display_color.should == 'aabbccdd'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'returns a default color for nil' do
|
14
|
+
node = double(xpath: double(first: nil))
|
15
|
+
track = Track.new(node, {})
|
16
|
+
track.display_color.should == 'f0000080'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tf1_converter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- spec/fixtures/expected.kml
|
172
172
|
- spec/fixtures/test.gpx
|
173
173
|
- spec/fixtures/test.kml
|
174
|
+
- spec/lib/tf1_converter/gpx/track_spec.rb
|
174
175
|
- spec/lib/tf1_converter/translation_spec.rb
|
175
176
|
- tf1_converter.gemspec
|
176
177
|
homepage: ''
|
@@ -187,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
188
|
version: '0'
|
188
189
|
segments:
|
189
190
|
- 0
|
190
|
-
hash: -
|
191
|
+
hash: -3878995865958803192
|
191
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
193
|
none: false
|
193
194
|
requirements:
|
@@ -196,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
197
|
version: '0'
|
197
198
|
segments:
|
198
199
|
- 0
|
199
|
-
hash: -
|
200
|
+
hash: -3878995865958803192
|
200
201
|
requirements: []
|
201
202
|
rubyforge_project:
|
202
203
|
rubygems_version: 1.8.23
|
@@ -207,4 +208,5 @@ test_files:
|
|
207
208
|
- spec/fixtures/expected.kml
|
208
209
|
- spec/fixtures/test.gpx
|
209
210
|
- spec/fixtures/test.kml
|
211
|
+
- spec/lib/tf1_converter/gpx/track_spec.rb
|
210
212
|
- spec/lib/tf1_converter/translation_spec.rb
|