5

I'd like to check if the country name provided belongs to Europe. Does anyone know of a list of european countries that can be used in a Ruby project?

I'd like to do something like this:

spain = Country.named('Spain')

spain.parent # => 'Europe'

japan = Country.named('Japan')

japan.parent # => 'Asia'

https://github.com/jim/carmen/ lets me list subregions of a country, but not a country's parent.

martins
  • 9,669
  • 11
  • 57
  • 85

2 Answers2

10

Try that gem if you really need whole gem for this. You should be able to do:

Country.find_all_countries_by_region('Europe')

to get countries in Europe.

zrl3dx
  • 7,699
  • 3
  • 25
  • 35
  • 1
    Mr Manners reminds the Gentle Poster to remember to mark this as the correct answer, _after_ you install and audition that library... – Phlip Jan 03 '14 at 00:07
1

Check out the Wikipedia article for a complete list. http://en.wikipedia.org/wiki/List_of_European_countries