Skip to content

Commit

Permalink
Refactored the priority_countries_method slightly with map (no us…
Browse files Browse the repository at this point in the history
…e for the auxiliary `out` variable now). Stupid me, thanks Gunnie from #rubyonrails@ircnet.cz
  • Loading branch information
karmi committed Oct 24, 2008
1 parent 531e29b commit 4acfd55
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/localized_country_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ def localized_countries_array
# # => [ ['Taiwan', 'TW'], ['China', 'CN'] ]
def priority_countries_array(country_codes=[])
countries = I18n.translate(:countries)
out = []
country_codes.each { |code| out << [countries[code], code.to_s.upcase] }
out
# out = []
# country_codes.each { |code| out << [countries[code], code.to_s.upcase] }
# out
country_codes.map { |code| [countries[code], code.to_s.upcase] }
end
end
end
Expand Down

0 comments on commit 4acfd55

Please sign in to comment.