File: currency_methods.rb

package info (click to toggle)
ruby-countries 4.2.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,196 kB
  • sloc: ruby: 2,085; makefile: 4
file content (13 lines) | stat: -rw-r--r-- 500 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'money'

module ISO3166
  # Optional extension which allows you to get back a +Money::Currency+ object with all the currency info.
  # This requires enabling the integration with the {Money}[https://github.com/RubyMoney/money] gem (See {ISO3166::Configuration#enable_currency_extension!})
  module CountryCurrencyMethods

    # @return [Money::Currency] The currency data for this Country's +currency_code+
    def currency
      Money::Currency.find(data['currency_code'])
    end
  end
end