No commit activity in last 3 years
No release in over 3 years
Provides a helper to get a country list along with ISO code, currency code and currency symbol by following ISO 3166 country list.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
~> 1.1
>= 0
~> 2.14
~> 0.8
 Project Readme

CountryWithCurrency

Provides a helper to get a country list along with ISO 3166-1 code, country number, currency code and currency symbol by following ISO 3166 country list.

Installation

Add this line to your application's Gemfile:

gem 'country_with_currency'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install country_with_currency

Basic Usage

To get all countries:

Country.all
=> [#<Country:0xa1b6e80 @number="004", @iso="AFG", @currency="AFN", @name="Afghanistan", @symbol="Af">,...]

Attribute-Based Finder

You can lookup a country or an array of countries using any of the data attributes via the find_by_attribute dynamic finder:

Country.find_by_name('United States')
=> [#<Country:0xa1b8a00 @number="840", @iso="USA", @currency="USD", @name="United States", @symbol="$">]
Country.find_by_iso('USA')
=> [#<Country:0xa1b8a00 @number="840", @iso="USA", @currency="USD", @name="United States", @symbol="$">]
Country.find_by_currency('INR')
=> [#<Country:0xa1b43c4 @number="356", @iso="IND", @currency="INR", @name="India", @symbol="Rs.">]
Country.find_by_number(840)
=> [#<Country:0x8b64a10 @number="840", @iso="USA", @currency="USD", @name="United States", @symbol="$">]

Contributing

  1. Fork it ( http://github.com/dark-prince/country_with_currency/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request