open_gpx_2_kml 0.10.3 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- open_gpx_2_kml (0.10.3)
4
+ open_gpx_2_kml (0.10.4)
5
5
  builder (= 3.1.4)
6
6
  geo_swap (= 0.2.1)
7
7
  nokogiri (= 1.5.6)
@@ -15,11 +15,16 @@ module TF1Converter
15
15
  if symbol_name
16
16
  map_entry = @icon_map[symbol_name]
17
17
  return map_entry['icon'] if map_entry
18
- elsif name
18
+ end
19
+
20
+ if name
19
21
  @icon_map.values.each do |icon_data|
20
- return icon_data['icon'] if icon_data['name'].upcase == name.slice(0,3).upcase
22
+ if icon_data['name']
23
+ return icon_data['icon'] if icon_data['name'].upcase == name.slice(0,3).upcase
24
+ end
21
25
  end
22
26
  end
27
+
23
28
  'default.png'
24
29
  end
25
30
 
@@ -1,3 +1,3 @@
1
1
  module TF1Converter
2
- VERSION = "0.10.3"
2
+ VERSION = "0.10.4"
3
3
  end
@@ -38,6 +38,12 @@ module TF1Converter::Gpx
38
38
  waypoint.icon_name.should == '42.png'
39
39
  end
40
40
 
41
+ it 'can find a waypoint using an ampersand' do
42
+ waypoint = waypoint_from(waypoint_by_name_fragment.gsub(/C05/,'&05'))
43
+ icon_map['meaningoflife'] = { 'icon' => '42.png', 'name' => '&05' }
44
+ waypoint.icon_name.should == '42.png'
45
+ end
46
+
41
47
  it 'returns a default value if there is no sym node' do
42
48
  waypoint = waypoint_from(default_fragment)
43
49
  waypoint.icon_name.should == 'default.png'
@@ -45,8 +51,19 @@ module TF1Converter::Gpx
45
51
 
46
52
  it 'gives a default value if there is no hash match' do
47
53
  node.stub_chain(:children, :select, :first, :text){ '' }
54
+ node.stub_chain(:xpath, :first, :text){ '' }
48
55
  waypoint.icon_name.should == 'default.png'
49
56
  end
57
+
58
+ it 'matches by name if there is no useful symbol match' do
59
+ fragment = %Q{ <wpt lat="38.9199972" lon="-92.2972443">
60
+ <sym>Non-sense</sym>
61
+ <name>C05icon_name_42</name>
62
+ </wpt> }
63
+ waypoint = waypoint_from(fragment)
64
+ icon_map['meaningoflife'] = { 'icon' => '42.png', 'name' => 'C05' }
65
+ waypoint.icon_name.should == '42.png'
66
+ end
50
67
  end
51
68
 
52
69
  describe '#icon_meaning' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_gpx_2_kml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -254,7 +254,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
254
254
  version: '0'
255
255
  segments:
256
256
  - 0
257
- hash: 2485090832370901195
257
+ hash: 788333395735345652
258
258
  required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  none: false
260
260
  requirements:
@@ -263,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
263
  version: '0'
264
264
  segments:
265
265
  - 0
266
- hash: 2485090832370901195
266
+ hash: 788333395735345652
267
267
  requirements: []
268
268
  rubyforge_project:
269
269
  rubygems_version: 1.8.23