Method: ISO3166::CountryClassMethods#all_names_with_codes

Defined in:
lib/countries/country/class_methods.rb

#all_names_with_codes(locale = :en) ⇒ Object

:reek:UtilityFunction :reek:ManualDispatch



43
44
45
46
47
48
# File 'lib/countries/country/class_methods.rb', line 43

def all_names_with_codes(locale = :en)
  Country.all.map do |country|
    lc = country.translation(locale) || country.iso_short_name
    [lc.respond_to?('html_safe') ? lc.html_safe : lc, country.alpha2]
  end.sort
end