File: currency_methods.rb

package info (click to toggle)
ruby-countries 8.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,268 kB
  • sloc: ruby: 2,687; makefile: 4
file content (14 lines) | stat: -rw-r--r-- 530 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

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