Sha256: e267dc5c2e52836879c5790108bc2df60edf3aec26a389e97e0bac8964b8a3f3

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
country_with_currency-1.0.0 README.md