| Class | Money::Currency |
| In: |
lib/money/currency/loader.rb
lib/money/currency/heuristics.rb lib/money/currency.rb |
| Parent: | Object |
Represents a specific currency unit.
@see en.wikipedia.org/wiki/Currency @see iso4217.net/
| decimal_mark | -> | separator |
| thousands_separator | -> | delimiter |
| == | -> | eql? |
| decimal_mark | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| disambiguate_symbol | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| html_entity | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| id | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| iso_code | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| iso_numeric | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| name | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| priority | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| smallest_denomination | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| subunit | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| subunit_to_unit | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| symbol | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| symbol_first | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
| thousands_separator | [R] |
@!attribute [r] id
@return [Symbol] The symbol used to identify the currency, usually THE
lowercase +iso_code+ attribute.
@!attribute [r] priority
@return [Integer] A numerical value you can use to sort/group the
currency list.
@!attribute [r] iso_code
@return [String] The international 3-letter code as defined by the ISO
4217 standard.
@!attribute [r] iso_numeric
@return [String] The international 3-numeric code as defined by the ISO
4217 standard.
@!attribute [r] name @return [String] The currency name. @!attribute [r] symbol @return [String] The currency symbol (UTF-8 encoded). @!attribute [r] disambiguate_symbol @return [String] Alternative currency used if symbol is ambiguous @!attribute [r] html_entity @return [String] The html entity for the currency symbol @!attribute [r] subunit @return [String] The name of the fractional monetary unit. @!attribute [r] subunit_to_unit @return [Integer] The proportion between the unit and the subunit @!attribute [r] decimal_mark
@return [String] The decimal mark, or character used to separate the
whole unit from the subunit.
@!attribute [r] thousands_separator
@return [String] The character used to separate thousands grouping of
the whole unit.
@!attribute [r] symbol_first
@return [Boolean] Should the currency symbol precede the amount, or
should it come after?
@!attribute [r] smallest_denomination
@return [Integer] Smallest amount of cash possible (in the subunit of
this currency)
|
List the currencies imported and registered @return [Array]
@example
Money::Currency.iso_codes() [#<Currency ..USD>, 'CAD', 'EUR']...
Lookup a currency with given id an returns a Currency instance on success, nil otherwise.
@param [String, Symbol, to_s] id Used to look into table and retrieve the applicable attributes.
@return [Money::Currency]
@example
Money::Currency.find(:eur) #=> #<Money::Currency id: eur ...> Money::Currency.find(:foo) #=> nil
Lookup a currency with given num as an ISO 4217 numeric and returns an Currency instance on success, nil otherwise.
@param [to_s] num used to look into table in iso_numeric and find the right currency id.
@return [Money::Currency]
@example
Money::Currency.find_by_iso_numeric(978) #=> #<Money::Currency id: eur ...>
Money::Currency.find_by_iso_numeric('001') #=> nil
@param [String, Symbol, to_s] id Used to look into table and retrieve
the applicable attributes.
@return [Money::Currency]
@example
Money::Currency.new(:usd) #=> #<Money::Currency id: usd ...>
Register a new currency
@param curr [Hash] information about the currency @option priority [Numeric] a numerical value you can use to sort/group
the currency list
@option iso_code [String] the international 3-letter code as defined
by the ISO 4217 standard
@option iso_numeric [Integer] the international 3-digit code as
defined by the ISO 4217 standard
@option name [String] the currency name @option symbol [String] the currency symbol (UTF-8 encoded) @option subunit [String] the name of the fractional monetary unit @option subunit_to_unit [Numeric] the proportion between the unit and
the subunit
@option separator [String] character between the whole and fraction
amounts
@option delimiter [String] character between each thousands place
We need a string-based validator before creating an unbounded number of symbols. www.randomhacks.net/articles/2007/01/20/13-ways-of-looking-at-a-ruby-symbol#11 github.com/RubyMoney/money/issues/132
@return [Set]
List of known currencies.
The standard unit of value of a currency, as the dollar in the United States or the peso in Mexico. www.answers.com/topic/monetary-unit
A monetary unit that is valued at a fraction (usually one hundredth) of the basic monetary unit www.answers.com/topic/fractional-monetary-unit-subunit
See en.wikipedia.org/wiki/List_of_circulating_currencies and search.cpan.org/~tnguyen/Locale-Currency-Format-1.28/Format.pm
Unregister a currency.
@param [Object] curr A Hash with the key `:iso_code`, or the ISO code
as a String or Symbol.
@return [Boolean] true if the currency previously existed, false
if it didn't.
Wraps the object in a Currency unless it‘s already a Currency object.
@param [Object] object The object to attempt and wrap as a Currency object.
@return [Money::Currency]
@example
c1 = Money::Currency.new(:usd)
Money::Currency.wrap(nil) #=> nil
Money::Currency.wrap(c1) #=> #<Money::Currency id: usd ...>
Money::Currency.wrap("usd") #=> #<Money::Currency id: usd ...>
Compares self with other_currency against the value of priority attribute.
@param [Money::Currency] other_currency The currency to compare to.
@return [-1,0,1] -1 if less than, 0 is equal to, 1 if greater than
@example
c1 = Money::Currency.new(:usd) c2 = Money::Currency.new(:jpy) c1 <=> c2 #=> 1 c2 <=> c1 #=> -1 c1 <=> c1 #=> 0
Compares self with other_currency and returns true if the are the same or if their id attributes match.
@param [Money::Currency] other_currency The currency to compare to.
@return [Boolean]
@example
c1 = Money::Currency.new(:usd) c2 = Money::Currency.new(:jpy) c1 == c1 #=> true c1 == c2 #=> false
Returns the relation between subunit and unit as a base 10 exponent.
Note that MGA and MRO are exceptions and are rounded to 1 @see en.wikipedia.org/wiki/ISO_4217#Active_codes
@return [Integer]
Returns a Integer hash value based on the id attribute in order to use functions like & (intersection), group_by, etc.
@return [Integer]
@example
Money::Currency.new(:usd).hash #=> 428936
Returns a human readable representation.
@return [String]
@example
Money::Currency.new(:usd) #=> #<Currency id: usd ...>
Returns a string representation corresponding to the upcase id attribute.
— DEV: id.to_s.upcase corresponds to iso_code but don‘t use ISO_CODE for consistency.
@return [String]
@example
Money::Currency.new(:usd).to_s #=> "USD" Money::Currency.new(:eur).to_s #=> "EUR"
Returns a string representation corresponding to the upcase id attribute. Useful in cases where only implicit conversions are made.
@return [String]
@example
Money::Currency.new(:usd).to_str #=> "USD" Money::Currency.new(:eur).to_str #=> "EUR"