DevHeads.net

fifa gem - the world's football countries and codes (incl. non-member countries and irregular codes)

Hello,

I've put together a new fifa gem / library [1]
that includes all the world's football countries and codes
(incl. non-member countries and irregular codes).

For example, to get a list of all countries use:

pp Fifa.countries

printing:

```
[#<Country @fifa="AFG", @key="af", @name="Afghanistan">,
#<Country @fifa="ALB", @key="al", @name="Albania">,
#<Country @fifa="ALG", @key="dz", @name="Algeria">,
#<Country @fifa="ASA", @key="as", @name="American Samoa">,
#<Country @fifa="AND", @key="ad", @name="Andorra">,
#<Country @fifa="ANG", @key="ao", @name="Angola">,
#<Country @fifa="AIA", @key="ai", @name="Anguilla">,
#<Country @fifa="ATG", @key="ag", @name="Antigua and Barbuda">,
#<Country @fifa="ARG", @key="ar", @name="Argentina">,
#<Country @fifa="ARM", @key="am", @name="Armenia">,
#<Country @fifa="ARU", @key="aw", @name="Aruba">,
#<Country @fifa="AUS", @key="au", @name="Australia">,
#<Country @fifa="AUT", @key="at", @name="Austria">,
#<Country @fifa="AZE", @key="az", @name="Azerbaijan">,
...
]
```

or to lookup England use:

```ruby
eng = Fifa['ENG']
# -or-
eng = Fifa['eng']
eng = Fifa[:eng]

eng.key #=> "eng"
eng.name #=> "England"
eng.fifa #=> "ENG"
# ...
``

Happy data wrangling with ruby. Enjoy the beautiful game. Cheers. Prost.

[1] <a href="https://github.com/sportdb/sport.db/tree/master/fifa" title="https://github.com/sportdb/sport.db/tree/master/fifa">https://github.com/sportdb/sport.db/tree/master/fifa</a>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Comments

Re: fifa gem - the world's football countries and codes (incl. n

By Gerald Bauer at 09/28/2019 - 14:15

Hello,

I’ve updated the fifa gem / library that includes all the world’s
200+ football countries and codes (incl. non-member countries and
irregular codes) [1].

What's news? Now you can also get the countries by continental
confederations (e.g. Asia, Africa, North & Central America &
Caribbean, South America, Oceania, etc.) or (sub)confederations (e.g.
Middle East, North Africa, South East Asia, etc. ) and more.

Use:

``` ruby

Fifa.members( 'FIFA' ).size #=> 211 members -or-
Fifa.members( 'World' ).size #=> 211 members

Fifa.members( 'AFC' ).size #=> 47 members -or-
Fifa.members( 'Asia' ).size #=> 47 members

Fifa.members( 'CAF').size #=> 56 members -or-
Fifa.members( 'Africa' ).size #=> 56 members

Fifa.members( 'CONCACAF').size #=> 41 members -or-
Fifa.members( 'North, Central America and Caribbean').size #=> 41 members

Fifa.members( 'CONMEBOL' ).size #=> 10 members -or-
Fifa.members( 'South America' ).size #=> 10 members

Fifa.members( 'OFC' ).size #=> 14 members -or-
Fifa.members( 'Oceania' ).size #=> 14 members

Fifa.members( 'UEFA' ).size #=> 55 members -or-
Fifa.members( 'Europe' ).size #=> 55 members

# and so on
```

Happy data wrangling with ruby. Enjoy the beautiful game. Cheers. Prost.

[1] <a href="https://github.com/sportdb/sport.db/tree/master/fifa" title="https://github.com/sportdb/sport.db/tree/master/fifa">https://github.com/sportdb/sport.db/tree/master/fifa</a>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>