- autotags = { 'point' => {}, 'way' => {}, 'POI' => {} }
- File.open("#{Rails.root}/config/potlatch/autocomplete.txt") do |file|
- file.each_line do|line|
- next unless line.chomp =~ /^([\w:]+)\/(\w+)\s+(.+)$/
-
- tag = $1
- type = $2
- values = $3
- if values == '-'
- autotags[type][tag] = []
- else
- autotags[type][tag] = values.split(',').sort.reverse
- end
+ autotags = { "point" => {}, "way" => {}, "POI" => {} }
+ File.open(Rails.root.join("config", "potlatch", "autocomplete.txt")) do |file|
+ file.each_line do |line|
+ next unless line.chomp =~ %r{^([\w:]+)/(\w+)\s+(.+)$}
+
+ tag = Regexp.last_match(1)
+ type = Regexp.last_match(2)
+ values = Regexp.last_match(3)
+ autotags[type][tag] = if values == "-"
+ []
+ else
+ values.split(",").sort.reverse
+ end