cartocss_helper 1.2.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8686f0a5acb7db504aec14f93f683c89dfd06248
4
+ data.tar.gz: 1f482eba9f389cdceb37e5253c2520a47725128b
5
+ SHA512:
6
+ metadata.gz: f23d8415d318009faf84f70e3f6ae1fb63b80033227c340ba3d647c45a0cc86314c4ec76dc4e07e3d5a2a751415b0cb60affa2a6db92351f1cd031492af54a19
7
+ data.tar.gz: e86b7bca3b6b4f9f1a84aee7d861d121bb276b1667e7a005d86fc052e1bfe858266da79c2f256de19c3824802fbbcdcf4f33ce2ddd6889f758ff199a0c11d7db
@@ -5,150 +5,135 @@ module CartoCSSHelper
5
5
  end
6
6
  require_relative 'cartocss_helper/tag_lister.rb'
7
7
  require_relative 'cartocss_helper/visualise_changes_image_generation.rb'
8
- require_relative 'cartocss_helper/downloader.rb'
8
+ require_relative 'cartocss_helper/overpass_query_generator.rb'
9
9
  require_relative 'cartocss_helper/data_file_handling.rb'
10
10
  require_relative 'cartocss_helper/validator.rb'
11
11
  require_relative 'cartocss_helper/git.rb'
12
+ require_relative 'cartocss_helper/util/generic_downloader.rb'
13
+ require_relative 'cartocss_helper/notes_downloader.rb'
14
+ require_relative 'cartocss_helper/style_specific/default_osm_style.rb'
12
15
  require_relative 'data/testing_locations'
16
+
13
17
  include CartoCSSHelper::Validator
14
18
  include CartoCSSHelper::Git
15
19
 
16
20
  module CartoCSSHelper
17
- def self.test_tag_on_real_data(tags, new_branch, old_branch, zlevels, types=['node', 'closed_way', 'way'], min = 4, skip = 0)
18
- types.each {|type|
21
+ def self.test_tag_on_real_data(tags, new_branch, old_branch, zlevels, types = ['node', 'closed_way', 'way'], min = 4, skip = 0)
22
+ types.each do |type|
19
23
  test_tag_on_real_data_for_this_type(tags, new_branch, old_branch, zlevels, type, min, skip)
20
- }
24
+ end
21
25
  end
22
26
 
23
27
  def self.test_tag_on_real_data_for_this_type(tags, new_branch, old_branch, zlevels, type, min = 4, skip = 0)
24
- if type.kind_of?(Array)
25
- type = type[0]
26
- end
28
+ type = type[0] if type.is_a?(Array)
27
29
  generated = 0
28
30
 
29
31
  n = 0
30
- max_n = get_maxn_for_nth_location
32
+ max_n = CartoCSSHelper.get_maxn_for_nth_location
31
33
  max_n -= skip
32
34
  skip_string = ''
33
- if skip > 0
34
- skip_string = " (#{skip} locations skipped)"
35
- end
35
+ skip_string = " (#{skip} locations skipped)" if skip > 0
36
36
  while generated < min
37
- location = get_nth_location(n + skip)
38
- generated +=1 if CartoCSSHelper::VisualDiff.visualise_changes_on_real_data(tags, type, location[0], location[1], zlevels, new_branch, old_branch)
39
- n+=1
40
- if n > max_n
41
- return
42
- end
37
+ location = CartoCSSHelper.get_nth_location(n + skip)
38
+ generated += 1 if CartoCSSHelper::VisualDiff.visualise_on_overpass_data(tags, type, location[0], location[1], zlevels, new_branch, old_branch)
39
+ n += 1
40
+ return if n > max_n
43
41
  puts "#{n}/#{max_n} locations checked #{skip_string}. #{generated}/#{min} testing location found"
44
42
  end
45
43
  end
46
44
 
47
45
  def self.get_maxn_for_nth_location
48
- return get_list_of_testing_locations.length-1
46
+ return get_list_of_testing_locations.length - 1
49
47
  end
50
48
 
51
49
  def self.get_nth_location(n)
52
50
  return get_list_of_testing_locations[n]
53
51
  end
54
52
 
55
-
56
53
  def self.add_common_secondary_tags(tags)
57
- added_tags = {'name' => 'ÉÉÉÉÉÉ ÉÉÉÉÉÉ', 'ref' => '1', 'ele' => '8000', 'operator' => 'ÉÉ ÉÉ ÉÉ operator', 'brand' => 'ÉÉ ÉÉ ÉÉ brand'}
54
+ added_tags = { 'name' => 'ÉÉÉÉÉÉ ÉÉÉÉÉÉ', 'ref' => '1', 'ele' => '8000', 'operator' => 'ÉÉ ÉÉ ÉÉ operator', 'brand' => 'ÉÉ ÉÉ ÉÉ brand' }
58
55
  return tags.merge(added_tags)
59
56
  end
60
57
 
61
- def self.test_tag_on_sythetic_data(tags, new_branch, old_branch='master', zlevels=Configuration.get_min_z..Configuration.get_max_z, types=['node', 'closed_way', 'way'], test_on_water=false)
58
+ def self.test_tag_on_sythetic_data(tags, new_branch, old_branch = 'master', zlevels = Configuration.get_min_z..Configuration.get_max_z, types = ['node', 'closed_way', 'way'], test_on_water = false)
62
59
  syn_tags = add_common_secondary_tags(tags)
63
- types.each {|type|
64
- CartoCSSHelper::VisualDiff.visualise_changes_synthethic_test(syn_tags, type, test_on_water, zlevels, new_branch, old_branch)
65
- }
60
+ types.each do |type|
61
+ CartoCSSHelper::VisualDiff.visualise_on_synthethic_data(syn_tags, type, test_on_water, zlevels, new_branch, old_branch)
62
+ end
66
63
  end
67
64
 
68
- def self.test(tags, new_branch, old_branch='master', zlevels=Configuration.get_min_z..Configuration.get_max_z, types=['node', 'closed_way', 'way'], test_on_water=false)
69
- puts "processing #{VisualDiff.dict_to_pretty_tag_list(tags)}"
65
+ def self.test(tags, new_branch, old_branch = 'master', zlevels = Configuration.get_min_z..Configuration.get_max_z, types = ['node', 'closed_way', 'way'], test_on_water = false)
66
+ puts "processing #{VisualDiff.tag_dict_to_string(tags)}"
70
67
  test_tag_on_sythetic_data(tags, new_branch, old_branch, zlevels, types, test_on_water)
71
68
  test_tag_on_real_data(tags, new_branch, old_branch, zlevels, types)
72
69
  end
73
70
 
74
- def self.probe(tags, new_branch, old_branch='master', zlevels=Configuration.get_min_z..Configuration.get_max_z, types=['node', 'closed_way', 'way'], test_on_water=false)
71
+ def self.probe(tags, new_branch, old_branch = 'master', zlevels = Configuration.get_min_z..Configuration.get_max_z, types = ['node', 'closed_way', 'way'], test_on_water = false)
75
72
  syn_tags = add_common_secondary_tags(tags)
76
- types.each {|type|
77
- CartoCSSHelper::VisualDiff.visualise_changes_synthethic_test(syn_tags, type, test_on_water, zlevels, new_branch, old_branch)
78
- }
73
+ types.each do |type|
74
+ CartoCSSHelper::VisualDiff.visualise_on_synthethic_data(syn_tags, type, test_on_water, zlevels, new_branch, old_branch)
75
+ end
79
76
  end
80
77
 
81
78
  def self.get_latitude_longitude_from_url(url)
82
- if(url.scan(/[\/]((-|)\d+(\.\d+))/)).length >= 2
83
- latitude = url.scan(/[\/]((-|)\d+(\.\d+))/)[0][0].to_f
84
- longitude = url.scan(/[\/]((-|)\d+(\.\d+))/)[1][0].to_f
85
- return latitude, longitude
86
- end
87
- latitude = url.scan(/[\/=]((-|)\d+(\.\d+))/)[0][0].to_f
88
- longitude = url.scan(/[\/=]((-|)\d+(\.\d+))/)[1][0].to_f
79
+ lat_lon = url.scan(/[\/=]((-|)\d+(\.\d+))/)
80
+ latitude = lat_lon[0][0].to_f
81
+ longitude = lat_lon[1][0].to_f
89
82
  return latitude, longitude
90
83
  end
91
84
 
92
- def self.visualise_place_by_url(url, zlevels, new_branch, old_branch='master', header=nil, download_bbox_size=0.04, image_size = 350)
93
- if header == nil
94
- header = url
95
- end
85
+ def self.visualise_place_by_url(url, zlevels, new_branch, old_branch = 'master', header = nil, download_bbox_size = 0.04, image_size = 350)
86
+ header = url if header == nil
96
87
 
97
88
  raise "#{url} is not a string, it is #{url.class}" unless url.class == String
98
89
  raise "#{zlevels} is not a range, it is #{zlevels.class}" unless zlevels.class == Range
99
90
  raise "#{new_branch} is not a string, it is #{new_branch.class}" unless new_branch.class == String
100
91
  raise "#{old_branch} is not a string, it is #{old_branch.class}" unless old_branch.class == String
101
92
  raise "#{header} is not a string, it is #{header.class}" unless header.class == String
102
- raise "#{download_bbox_size} is not a number" unless download_bbox_size.kind_of? Numeric
103
- raise "#{image_size} is not a integer" unless image_size.kind_of? Integer
93
+ raise "#{download_bbox_size} is not a number" unless download_bbox_size.is_a? Numeric
94
+ raise "#{image_size} is not a integer" unless image_size.is_a? Integer
104
95
 
105
96
  latitude, longitude = get_latitude_longitude_from_url(url)
106
- header += ' ' + old_branch + '->' + new_branch + ' ' + zlevels.to_s + ' '+ image_size.to_s + 'px'
107
- CartoCSSHelper::VisualDiff.visualise_changes_for_location(latitude, longitude, zlevels, header, new_branch, old_branch, download_bbox_size, image_size)
97
+ header += ' ' + old_branch + '->' + new_branch + ' ' + zlevels.to_s + ' ' + image_size.to_s + 'px'
98
+ CartoCSSHelper::VisualDiff.visualise_for_location(latitude, longitude, zlevels, header, new_branch, old_branch, download_bbox_size, image_size)
108
99
  end
109
100
 
110
101
  def self.get_place_of_storage_of_resource_under_url(url)
111
- return CartoCSSHelper::Configuration.get_path_to_folder_for_overpass_cache + '.manual.cache' + FileHelper::make_string_usable_as_filename(url)
102
+ return CartoCSSHelper::Configuration.get_path_to_folder_for_overpass_cache + '.manual.cache' + FileHelper.make_string_usable_as_filename(url)
112
103
  end
113
104
 
114
- def self.download_remote_file(url)
105
+ def self.download_remote_file(url, clear_cache = false)
115
106
  filename = get_place_of_storage_of_resource_under_url(url)
116
- if !File.exists?(filename)
117
- begin
118
- url = url
119
- timeout = 600
120
- data = RestClient::Request.execute(:method => :get, :url => url, :timeout => timeout)
121
- rescue => e
122
- puts "visualise_place_by_remote_file failed to fetch #{url}"
123
- raise e
124
- end
125
- file = File.new(filename, 'w')
126
- file.write data
127
- file.close
107
+ if clear_cache
108
+ File.delete(filename) if File.exist?(filename)
109
+ end
110
+ unless File.exist?(filename)
111
+ url = url
112
+ timeout = 600
113
+ downloader = GenericCachedDownloader.new(timeout: timeout)
114
+ return downloader.get_specified_resource(url, filename)
128
115
  end
129
116
  end
130
117
 
131
- def self.visualise_place_by_remote_file(url, latitude, longitude, zlevels, new_branch, old_branch='master', header=nil, bb=0.04, image_size = 350)
118
+ def self.visualise_place_by_remote_file(url, latitude, longitude, zlevels, new_branch, old_branch = 'master', header = nil, bb = 0.04, image_size = 350)
132
119
  download_remote_file(url)
133
120
  filename = get_place_of_storage_of_resource_under_url(url)
134
121
  visualise_place_by_file(filename, latitude, longitude, zlevels, new_branch, old_branch, header, bb, image_size)
135
122
  end
136
123
 
137
- def self.visualise_place_by_file(filename, latitude, longitude, zlevels, new_branch, old_branch='master', header=nil, bb=0.04, image_size = 350)
138
- raise "#{filename} does not exists" unless File.exists?(filename)
139
- raise "#{latitude} is not a number" unless latitude.kind_of? Numeric
140
- raise "#{longitude} is not a number" unless longitude.kind_of? Numeric
124
+ def self.visualise_place_by_file(filename, latitude, longitude, zlevels, new_branch, old_branch = 'master', header = nil, bb = 0.04, image_size = 350)
125
+ raise "#{filename} does not exists" unless File.exist?(filename)
126
+ raise "#{latitude} is not a number" unless latitude.is_a? Numeric
127
+ raise "#{longitude} is not a number" unless longitude.is_a? Numeric
141
128
  raise "#{zlevels} is not a range" unless zlevels.class == Range
142
129
  raise "#{new_branch} is not a string" unless new_branch.class == String
143
130
  raise "#{old_branch} is not a string" unless old_branch.class == String
144
131
  raise "#{header} is not a string" unless header.class == String
145
- raise "#{bb} is not a number" unless bb.kind_of? Numeric
146
- raise "#{image_size} is not a integer" unless image_size.kind_of? Integer
132
+ raise "#{bb} is not a number" unless bb.is_a? Numeric
133
+ raise "#{image_size} is not a integer" unless image_size.is_a? Integer
147
134
 
148
- if header == nil
149
- header = filename
150
- end
135
+ header = filename if header == nil
151
136
  header += ' ' + old_branch + '->' + new_branch + '[' + latitude.to_s + ',' + longitude.to_s + ']' + ' ' + image_size.to_s + 'px'
152
- CartoCSSHelper::VisualDiff.visualise_changes_for_location_from_file(filename, latitude, longitude, zlevels, header, new_branch, old_branch, bb, image_size)
137
+ CartoCSSHelper::VisualDiff.visualise_for_location_from_file(filename, latitude, longitude, zlevels, header, new_branch, old_branch, bb, image_size)
153
138
  end
154
- end
139
+ end
@@ -16,88 +16,135 @@ module CartoCSSHelper::Configuration
16
16
  return @style_specific_data
17
17
  end
18
18
 
19
- def get_max_z
19
+ def get_max_z
20
20
  return get_style_specific_data.max_z
21
- end
21
+ end
22
22
 
23
- def get_min_z
23
+ def get_min_z
24
24
  if @style_specific_data == nil
25
25
  raise 'Set your configuration data using CartoCSSHelper::Configuration.set_style_specific_data(data)'
26
26
  end
27
27
  return get_style_specific_data.min_z
28
- end
28
+ end
29
29
 
30
- def set_path_to_tilemill_project_folder(path)
30
+ # Link to project folder itself, not to folder containing various projects.
31
+ def set_path_to_cartocss_project_folder(path)
31
32
  @style_path = path
32
33
  end
33
34
 
34
- def get_path_to_tilemill_project_folder
35
+ def get_path_to_cartocss_project_folder
35
36
  if @style_path == nil
36
37
  raise 'Set your configuration data using CartoCSSHelper::Configuration.set_style_path(path)'
37
38
  end
38
- return @style_path
39
- end
39
+ return @style_path
40
+ end
40
41
 
41
- def get_tilemill_project_name
42
- return get_path_to_tilemill_project_folder.split(File::SEPARATOR)[-1]
42
+ def get_cartocss_project_name
43
+ return get_path_to_cartocss_project_folder.split(File::SEPARATOR)[-1]
43
44
  end
44
45
 
45
46
  def get_style_file_location
46
- if @style_file == nil
47
- @style_file = find_style_file_location
48
- end
47
+ @style_file = find_style_file_location if @style_file == nil
49
48
  return @style_file
50
49
  end
51
50
 
52
51
  def find_style_file_location
53
- Find.find(get_path_to_tilemill_project_folder) do |path|
54
- if path =~ /.*\.style$/
55
- return path
56
- end
52
+ Find.find(get_path_to_cartocss_project_folder) do |path|
53
+ return path if path =~ /.*\.style$/
54
+ end
55
+ end
56
+
57
+ def project_file_location
58
+ Find.find(get_path_to_cartocss_project_folder) do |path|
59
+ return path if path =~ /.*\.yaml$/
57
60
  end
58
61
  end
59
62
 
60
63
  def set_path_to_folder_for_output(path)
61
64
  @path_to_folder_for_output = path
62
- puts @path_to_folder_for_output
63
- puts @path_to_folder_for_cache
64
65
  end
65
66
 
66
67
  def get_path_to_folder_for_output
67
68
  if @path_to_folder_for_output == nil
68
69
  raise 'Set your configuration data using CartoCSSHelper::Configuration.set_path_to_folder_for_output(path)'
69
70
  end
70
- FileUtils::mkdir_p @path_to_folder_for_output
71
+ FileUtils.mkdir_p @path_to_folder_for_output
71
72
  return @path_to_folder_for_output
72
73
  end
73
74
 
74
75
  def set_path_to_folder_for_cache(path)
75
76
  @path_to_folder_for_cache = path
76
- puts @path_to_folder_for_output
77
- puts @path_to_folder_for_cache
78
77
  end
79
78
 
80
79
  def get_path_to_folder_for_cache
81
80
  if @path_to_folder_for_cache == nil
82
81
  raise 'Set your configuration data using CartoCSSHelper::Configuration.set_path_to_folder_for_cache(path)'
83
82
  end
84
- FileUtils::mkdir_p @path_to_folder_for_cache
83
+ FileUtils.mkdir_p @path_to_folder_for_cache
85
84
  return @path_to_folder_for_cache
86
85
  end
87
86
 
88
- def get_path_to_folder_for_branch_specific_cache
89
- location = File.join(get_path_to_folder_for_cache, 'generated_images', CartoCSSHelper::Git.get_commit_hash, '')
90
- FileUtils::mkdir_p location
91
- return location
92
- end
87
+ def get_path_to_folder_for_branch_specific_cache
88
+ location = File.join(get_path_to_folder_for_cache, 'generated_images', CartoCSSHelper::Git.get_commit_hash, '')
89
+ FileUtils.mkdir_p location
90
+ return location
91
+ end
92
+
93
+ def get_path_to_folder_for_overpass_cache
94
+ location = File.join(get_path_to_folder_for_cache, 'overpass', '')
95
+ FileUtils.mkdir_p location
96
+ return location
97
+ end
98
+
99
+ def get_path_to_folder_for_notes_api_cache
100
+ location = File.join(get_path_to_folder_for_cache, 'notes-api', '')
101
+ FileUtils.mkdir_p location
102
+ return location
103
+ end
104
+
105
+ def get_data_filename
106
+ return get_path_to_folder_for_branch_specific_cache + 'data.osm'
107
+ end
108
+
109
+ @overpass_instance_url = 'http://overpass-api.de/api'
110
+ def set_overpass_instance_url(path)
111
+ @overpass_instance_url = path
112
+ end
113
+
114
+ def set_known_alternative_overpass_url
115
+ set_overpass_instance_url('http://overpass.osm.rambler.ru/cgi')
116
+ end
117
+
118
+ def get_overpass_instance_url
119
+ return @overpass_instance_url
120
+ end
121
+
122
+ def set_path_to_kosmtik(path)
123
+ @kosmtik_path = path
124
+ end
125
+
126
+ def path_to_kosmtik
127
+ @kosmtik_path
128
+ end
129
+
130
+ def default_renderer
131
+ :tilemill
132
+ end
133
+
134
+ def set_renderer(renderer)
135
+ @renderer = renderer
136
+ end
137
+
138
+ def renderer
139
+ return default_renderer if @renderer == nil
140
+ return @renderer
141
+ end
93
142
 
94
- def get_path_to_folder_for_overpass_cache
95
- location = File.join(get_path_to_folder_for_cache, 'overpass', '')
96
- FileUtils::mkdir_p location
97
- return location
98
- end
143
+ def mapnik_reference_version_override
144
+ @mapnik_reference_version
145
+ end
99
146
 
100
- def get_data_filename
101
- return get_path_to_folder_for_branch_specific_cache+'data.osm'
102
- end
103
- end
147
+ def set_mapnik_reference_version_override(version)
148
+ @mapnik_reference_version = version
149
+ end
150
+ end
@@ -1,45 +1,42 @@
1
1
  # encoding: UTF-8
2
2
  require_relative 'configuration'
3
+ require_relative 'util/systemhelper.rb'
3
4
 
4
5
  module CartoCSSHelper
5
6
  class DataFileLoader
6
7
  @@loaded_filename = nil
7
8
  def self.get_filename_of_recently_loaded_file
8
- if @@loaded_filename == Configuration.get_data_filename
9
- return nil
10
- end
9
+ return nil if @@loaded_filename == Configuration.get_data_filename
11
10
  return @@loaded_filename
12
11
  end
13
12
 
14
- def self.load_data_into_database(data_filename, debug=false)
13
+ def self.get_command_to_load_using_osmpgsql(data_filename)
14
+ return "osm2pgsql --create --slim --drop --cache 10 --number-processes 1 --hstore --unlogged --style #{Configuration.get_style_file_location} --multi-geometry '#{data_filename}'"
15
+ end
16
+
17
+ def self.is_already_loaded(data_filename)
15
18
  if get_filename_of_recently_loaded_file == data_filename
16
19
  puts "\tavoided reloading the same file! <#{data_filename}>"
17
- return
20
+ return true
18
21
  end
22
+ return false
23
+ end
24
+
25
+ def self.load_data_into_database(data_filename, debug = false)
26
+ return if is_already_loaded(data_filename)
19
27
  start_time = Time.now
20
28
  puts "\tloading data into database <#{data_filename}>"
21
29
  @@loaded_filename = nil
22
- silence = '> /dev/null 2>&1'
23
- if debug
24
- silence = ''
25
- end
26
-
27
- command = "osm2pgsql --create --slim --cache 10 --number-processes 1 --hstore --style #{Configuration.get_style_file_location} --multi-geometry '#{data_filename}' #{silence}"
28
- if debug
29
- puts command
30
- end
31
- if !system(command)
30
+ begin
31
+ execute_command(get_command_to_load_using_osmpgsql(data_filename), debug, ignore_stderr_presence: true) # osm2pgsql outputs everything to stderr
32
+ rescue FailedCommandException => e
32
33
  puts 'loading data into database failed'
33
- if !debug
34
- puts 'retry with enabled debug'
35
- load_data_into_database(data_filename, true)
36
- else
37
- raise 'osm2pgsql failed'
38
- end
34
+ raise e if debug
35
+ puts 'retry with enabled debug'
36
+ load_data_into_database(data_filename, true)
39
37
  end
40
38
  @@loaded_filename = data_filename
41
- time_in_seconds = Time.now - start_time
42
- puts "\tloading lasted #{time_in_seconds.to_i}s"
39
+ puts "\tloading lasted #{(Time.now - start_time).to_i}s"
43
40
  end
44
41
  end
45
42
 
@@ -89,17 +86,17 @@ module CartoCSSHelper
89
86
  end
90
87
 
91
88
  def generate_way_topology(lat, lon, tags)
92
- add_node lat, lon-@size/3, [], 1
93
- add_node lat, lon+@size/3, [], 2
89
+ add_node lat, lon - @size / 3, [], 1
90
+ add_node lat, lon + @size / 3, [], 2
94
91
  add_way tags, [1, 2], 3
95
92
  end
96
93
 
97
94
  def generate_closed_way_topology(lat, lon, tags)
98
- delta = @size/3
99
- add_node lat-delta, lon-delta, [], 1
100
- add_node lat-delta, lon+delta, [], 2
101
- add_node lat+delta, lon+delta, [], 3
102
- add_node lat+delta, lon-delta, [], 4
95
+ delta = @size / 3
96
+ add_node lat - delta, lon - delta, [], 1
97
+ add_node lat - delta, lon + delta, [], 2
98
+ add_node lat + delta, lon + delta, [], 3
99
+ add_node lat + delta, lon - delta, [], 4
103
100
  add_way tags, [1, 2, 3, 4, 1], 5
104
101
  end
105
102
 
@@ -121,19 +118,19 @@ module CartoCSSHelper
121
118
  def add_way(tags, nodes, id)
122
119
  @data_file.write "\n"
123
120
  @data_file.write " <way id='#{id}' visible='true'>"
124
- nodes.each { |node|
121
+ nodes.each do |node|
125
122
  @data_file.write "\n"
126
123
  @data_file.write " <nd ref='#{node}' />"
127
- }
124
+ end
128
125
  add_tags(tags)
129
126
  @data_file.write "\n </way>"
130
127
  end
131
128
 
132
129
  def add_tags(tags)
133
- tags.each { |tag|
130
+ tags.each do |tag|
134
131
  @data_file.write "\n"
135
132
  @data_file.write " <tag k='#{tag[0]}' v='#{tag[1]}' />"
136
- }
133
+ end
137
134
  end
138
135
  end
139
- end
136
+ end