money 3.0.3 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +20 -0
- data/README.rdoc +22 -3
- data/VERSION +1 -1
- data/lib/money/core_extensions.rb +18 -4
- data/lib/money/currency.rb +165 -165
- data/lib/money/defaults.rb +5 -5
- data/lib/money/money.rb +21 -19
- data/lib/money/variable_exchange_bank.rb +12 -3
- data/money.gemspec +2 -2
- data/test/core_extensions_spec.rb +18 -0
- data/test/currency_spec.rb +9 -7
- data/test/exchange_bank_spec.rb +56 -0
- data/test/money_spec.rb +44 -30
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
== Money 3.0.5
|
|
2
|
+
* Added Money#abs
|
|
3
|
+
* Updated Currency#subunit_to_unit documentation (it's an integer not a
|
|
4
|
+
string)
|
|
5
|
+
* Fixed issue when exchanging currencies with different :subunit_to_unit
|
|
6
|
+
values
|
|
7
|
+
* Added ability to pass a block to VariableExchangeBank#new or #exchange,
|
|
8
|
+
specifying a custom truncation method
|
|
9
|
+
* Added optional currency argument to Numeric#to_money
|
|
10
|
+
* Added optional currency argument to String#to_money
|
|
11
|
+
* Numeric#to_money now respects :subunit_to_unit
|
|
12
|
+
* Use '¤' as the default currency symbol
|
|
13
|
+
|
|
14
|
+
== Money 3.0.4
|
|
15
|
+
* Updated #exchange to avoid floating point rounding errors
|
|
16
|
+
* Use :subunit_to_unit in #to_s, #to_f and #format
|
|
17
|
+
* Added :separator and :delimiter to Currency
|
|
18
|
+
* Deprecated Money#SEPARATORS and Money#DELIMITERS
|
|
19
|
+
* Updated the attributes of the Chilean Peso
|
|
20
|
+
|
|
1
21
|
== Money 3.0.3
|
|
2
22
|
* Added #currency_as_string and #currency_as_string= for easier integration
|
|
3
23
|
with ActiveRecord/Rails
|
data/README.rdoc
CHANGED
|
@@ -19,6 +19,15 @@ Resources:
|
|
|
19
19
|
- RDoc API: http://money.rubyforge.org
|
|
20
20
|
- Git repository: http://github.com/FooBarWidget/money
|
|
21
21
|
|
|
22
|
+
== Attention
|
|
23
|
+
|
|
24
|
+
Starting in v3.1.0 we will be making two changes to the exchange process. First
|
|
25
|
+
a new `Bank::Base` class will be available. This will allow users to more
|
|
26
|
+
easily create custom `Bank` classes. Secondly the default `#exchange` method
|
|
27
|
+
will be depreciated and a new `#exchange_with` method will be used. Currently
|
|
28
|
+
`#exchange` passes the `cents` attribute. `#exchange_with` will pass the
|
|
29
|
+
actual `Money` object instead.
|
|
30
|
+
|
|
22
31
|
== Download
|
|
23
32
|
|
|
24
33
|
Install stable releases with the following command:
|
|
@@ -73,7 +82,9 @@ containing all the currency attributes.
|
|
|
73
82
|
:name => "United States Dollar",
|
|
74
83
|
:symbol => "$",
|
|
75
84
|
:subunit => "Cent"
|
|
76
|
-
:subunit_to_unit =>
|
|
85
|
+
:subunit_to_unit => 100,
|
|
86
|
+
:separator => ".",
|
|
87
|
+
:delimiter => ","
|
|
77
88
|
}
|
|
78
89
|
|
|
79
90
|
The pre-defined set of attributes includes:
|
|
@@ -84,6 +95,8 @@ The pre-defined set of attributes includes:
|
|
|
84
95
|
* symbol: the currency symbol (UTF-8 encoded)
|
|
85
96
|
* subunit: the name of the fractional monetary unit
|
|
86
97
|
* subunit_to_unit: the proportion between the unit and the subunit
|
|
98
|
+
* separator: character between the whole and fraction amounts
|
|
99
|
+
* delimiter: character between each thousands place
|
|
87
100
|
|
|
88
101
|
All attributes are optional. Some attributes, such as <tt>:symbol</tt>, are used by the Money class
|
|
89
102
|
to print out a representation of the object. Other attributes, such as <tt>:name</tt> or <tt>:priority</tt>,
|
|
@@ -172,7 +185,10 @@ field.
|
|
|
172
185
|
|
|
173
186
|
class ProductUnit < ActiveRecord::Base
|
|
174
187
|
belongs_to :product
|
|
175
|
-
composed_of :price,
|
|
188
|
+
composed_of :price,
|
|
189
|
+
:class_name => "Money",
|
|
190
|
+
:mapping => [%w(cents cents), %w(currency currency_as_string)],
|
|
191
|
+
:constructor => Proc.new { |cents, currency| Money.new(cents || 0, currency || Money.default_currency) }
|
|
176
192
|
|
|
177
193
|
private
|
|
178
194
|
validate :cents_not_zero
|
|
@@ -188,6 +204,9 @@ field.
|
|
|
188
204
|
For Money 2.2.x and previous versions, simply use the following
|
|
189
205
|
<tt>composed_of</tt> definition:
|
|
190
206
|
|
|
191
|
-
composed_of :price,
|
|
207
|
+
composed_of :price,
|
|
208
|
+
:class_name => "Money",
|
|
209
|
+
:mapping => [%w(cents cents), %w(currency currency)],
|
|
210
|
+
:constructor => Proc.new { |cents, currency| Money.new(cents || 0, currency || Money.default_currency) }
|
|
192
211
|
|
|
193
212
|
For further details read the full discussion at http://github.com/FooBarWidget/money/issues/4#comment_224880
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.0.
|
|
1
|
+
3.0.5
|
|
@@ -6,8 +6,9 @@ class Numeric
|
|
|
6
6
|
# 100.37.to_money => #<Money @cents=10037>
|
|
7
7
|
# require 'bigdecimal'
|
|
8
8
|
# BigDecimal.new('100').to_money => #<Money @cents=10000>
|
|
9
|
-
def to_money
|
|
10
|
-
Money.new(
|
|
9
|
+
def to_money(currency = Money.default_currency)
|
|
10
|
+
currency = Money::Currency.new(currency) unless currency.is_a?(Money::Currency)
|
|
11
|
+
Money.new((self * currency.subunit_to_unit).to_int, currency)
|
|
11
12
|
end
|
|
12
13
|
end
|
|
13
14
|
|
|
@@ -22,10 +23,23 @@ class String
|
|
|
22
23
|
# 'USD 100'.to_money # => #<Money @cents=10000, @currency="USD">
|
|
23
24
|
# '$100 USD'.to_money # => #<Money @cents=10000, @currency="USD">
|
|
24
25
|
# 'hello 2000 world'.to_money # => #<Money @cents=200000 @currency="USD")>
|
|
25
|
-
def to_money
|
|
26
|
+
def to_money(currency = nil)
|
|
26
27
|
# Get the currency.
|
|
27
28
|
matches = scan /([A-Z]{2,3})/
|
|
28
|
-
|
|
29
|
+
_currency_ = matches[0] ? matches[0][0] : nil
|
|
30
|
+
|
|
31
|
+
# check that currency passed and embedded currency are the same, or only
|
|
32
|
+
# one or the other is present.
|
|
33
|
+
if currency.nil? and _currency_.nil?
|
|
34
|
+
currency = Money.default_currency
|
|
35
|
+
elsif currency.nil?
|
|
36
|
+
currency = _currency_
|
|
37
|
+
elsif _currency_.nil?
|
|
38
|
+
currency = currency
|
|
39
|
+
elsif currency != _currency_
|
|
40
|
+
raise "mismatching currencies"
|
|
41
|
+
end
|
|
42
|
+
|
|
29
43
|
cents = calculate_cents(self)
|
|
30
44
|
Money.new(cents, currency)
|
|
31
45
|
end
|
data/lib/money/currency.rb
CHANGED
|
@@ -15,7 +15,7 @@ class Money
|
|
|
15
15
|
# * symbol: the currency symbol (UTF-8 encoded)
|
|
16
16
|
# * subunit: the name of the fractional monetary unit
|
|
17
17
|
# * subunit_to_unit: the proportion between the unit and the subunit
|
|
18
|
-
ATTRIBUTES = [ :priority, :iso_code, :name, :symbol, :subunit, :subunit_to_unit ]
|
|
18
|
+
ATTRIBUTES = [ :priority, :iso_code, :name, :symbol, :subunit, :subunit_to_unit, :separator, :delimiter ]
|
|
19
19
|
|
|
20
20
|
TABLE = {
|
|
21
21
|
# monetary unit
|
|
@@ -26,172 +26,172 @@ class Money
|
|
|
26
26
|
# http://www.answers.com/topic/fractional-monetary-unit-subunit
|
|
27
27
|
#
|
|
28
28
|
# See http://en.wikipedia.org/wiki/List_of_circulating_currencies
|
|
29
|
-
:aed => { :priority => 100, :iso_code => "AED", :name => "United Arab Emirates Dirham", :symbol => "د.إ", :subunit => "Fils", :subunit_to_unit =>
|
|
30
|
-
:afn => { :priority => 100, :iso_code => "AFN", :name => "Afghan Afghani", :symbol => "؋", :subunit => "Pul", :subunit_to_unit =>
|
|
31
|
-
:all => { :priority => 100, :iso_code => "ALL", :name => "Albanian Lek", :symbol => "L", :subunit => "Qintar", :subunit_to_unit =>
|
|
32
|
-
:amd => { :priority => 100, :iso_code => "AMD", :name => "Armenian Dram", :symbol => "դր.", :subunit => "Luma", :subunit_to_unit =>
|
|
33
|
-
:ang => { :priority => 100, :iso_code => "ANG", :name => "Netherlands Antillean Gulden", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit =>
|
|
34
|
-
:aoa => { :priority => 100, :iso_code => "AOA", :name => "Angolan Kwanza", :symbol => "Kz", :subunit => "Cêntimo", :subunit_to_unit =>
|
|
35
|
-
:ars => { :priority => 100, :iso_code => "ARS", :name => "Argentine Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit =>
|
|
36
|
-
:aud => { :priority => 4, :iso_code => "AUD", :name => "Australian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
37
|
-
:awg => { :priority => 100, :iso_code => "AWG", :name => "Aruban Florin", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit =>
|
|
38
|
-
:azn => { :priority => 100, :iso_code => "AZN", :name => "Azerbaijani Manat", :symbol => nil, :subunit => "Qəpik", :subunit_to_unit =>
|
|
39
|
-
:bam => { :priority => 100, :iso_code => "BAM", :name => "Bosnia and Herzegovina Convertible Mark", :symbol => "KM or КМ", :subunit => "Fening", :subunit_to_unit =>
|
|
40
|
-
:bbd => { :priority => 100, :iso_code => "BBD", :name => "Barbadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
41
|
-
:bdt => { :priority => 100, :iso_code => "BDT", :name => "Bangladeshi Taka", :symbol => "৳", :subunit => "Paisa", :subunit_to_unit =>
|
|
42
|
-
:bgn => { :priority => 100, :iso_code => "BGN", :name => "Bulgarian Lev", :symbol => "лв", :subunit => "Stotinka", :subunit_to_unit =>
|
|
43
|
-
:bhd => { :priority => 100, :iso_code => "BHD", :name => "Bahraini Dinar", :symbol => "ب.د", :subunit => "Fils", :subunit_to_unit => "
|
|
44
|
-
:bif => { :priority => 100, :iso_code => "BIF", :name => "Burundian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
45
|
-
:bmd => { :priority => 100, :iso_code => "BMD", :name => "Bermudian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
46
|
-
:bnd => { :priority => 100, :iso_code => "BND", :name => "Brunei Dollar", :symbol => "$", :subunit => "Sen", :subunit_to_unit =>
|
|
47
|
-
:bob => { :priority => 100, :iso_code => "BOB", :name => "Bolivian Boliviano", :symbol => "Bs.", :subunit => "Centavo", :subunit_to_unit =>
|
|
48
|
-
:brl => { :priority => 100, :iso_code => "BRL", :name => "Brazilian Real", :symbol => "R$ ", :subunit => "Centavo", :subunit_to_unit =>
|
|
49
|
-
:bsd => { :priority => 100, :iso_code => "BSD", :name => "Bahamian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
50
|
-
:btn => { :priority => 100, :iso_code => "BTN", :name => "Bhutanese Ngultrum", :symbol => nil, :subunit => "Chertrum", :subunit_to_unit =>
|
|
51
|
-
:bwp => { :priority => 100, :iso_code => "BWP", :name => "Botswana Pula", :symbol => "P", :subunit => "Thebe", :subunit_to_unit =>
|
|
52
|
-
:byr => { :priority => 100, :iso_code => "BYR", :name => "Belarusian Ruble", :symbol => "Br", :subunit => "Kapyeyka", :subunit_to_unit =>
|
|
53
|
-
:bzd => { :priority => 100, :iso_code => "BZD", :name => "Belize Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
54
|
-
:cad => { :priority => 5, :iso_code => "CAD", :name => "Canadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
55
|
-
:cdf => { :priority => 100, :iso_code => "CDF", :name => "Congolese Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
56
|
-
:chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit =>
|
|
57
|
-
:chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit =>
|
|
58
|
-
:clp => { :priority => 100, :iso_code => "CLP", :name => "Chilean Peso", :symbol => "$", :subunit => "
|
|
59
|
-
:cny => { :priority => 100, :iso_code => "CNY", :name => "Chinese Renminbi Yuan", :symbol => "¥", :subunit => "Jiao", :subunit_to_unit =>
|
|
60
|
-
:cop => { :priority => 100, :iso_code => "COP", :name => "Colombian Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit =>
|
|
61
|
-
:crc => { :priority => 100, :iso_code => "CRC", :name => "Costa Rican Colón", :symbol => "₡", :subunit => "Céntimo", :subunit_to_unit =>
|
|
62
|
-
:cuc => { :priority => 100, :iso_code => "CUC", :name => "Cuban Convertible Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit =>
|
|
63
|
-
:cup => { :priority => 100, :iso_code => "CUP", :name => "Cuban Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit =>
|
|
64
|
-
:cve => { :priority => 100, :iso_code => "CVE", :name => "Cape Verdean Escudo", :symbol => "$ or Esc", :subunit => "Centavo", :subunit_to_unit =>
|
|
65
|
-
:czk => { :priority => 100, :iso_code => "CZK", :name => "Czech Koruna", :symbol => "Kč", :subunit => "Haléř", :subunit_to_unit =>
|
|
66
|
-
:djf => { :priority => 100, :iso_code => "DJF", :name => "Djiboutian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
67
|
-
:dkk => { :priority => 100, :iso_code => "DKK", :name => "Danish Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit =>
|
|
68
|
-
:dop => { :priority => 100, :iso_code => "DOP", :name => "Dominican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit =>
|
|
69
|
-
:dzd => { :priority => 100, :iso_code => "DZD", :name => "Algerian Dinar", :symbol => "د.ج", :subunit => "Centime", :subunit_to_unit =>
|
|
70
|
-
:eek => { :priority => 100, :iso_code => "EEK", :name => "Estonian Kroon", :symbol => "KR", :subunit => "Sent", :subunit_to_unit =>
|
|
71
|
-
:egp => { :priority => 100, :iso_code => "EGP", :name => "Egyptian Pound", :symbol => "£ or ج.م", :subunit => "Piastre", :subunit_to_unit =>
|
|
72
|
-
:ern => { :priority => 100, :iso_code => "ERN", :name => "Eritrean Nakfa", :symbol => "Nfk", :subunit => "Cent", :subunit_to_unit =>
|
|
73
|
-
:etb => { :priority => 100, :iso_code => "ETB", :name => "Ethiopian Birr", :symbol => nil, :subunit => "Santim", :subunit_to_unit =>
|
|
74
|
-
:eur => { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit =>
|
|
75
|
-
:fjd => { :priority => 100, :iso_code => "FJD", :name => "Fijian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
76
|
-
:fkp => { :priority => 100, :iso_code => "FKP", :name => "Falkland Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit =>
|
|
77
|
-
:gbp => { :priority => 3, :iso_code => "GBP", :name => "British Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit =>
|
|
78
|
-
:gel => { :priority => 100, :iso_code => "GEL", :name => "Georgian Lari", :symbol => "ლ", :subunit => "Tetri", :subunit_to_unit =>
|
|
79
|
-
:ghc => { :priority => 100, :iso_code => "GHC", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit =>
|
|
80
|
-
:gip => { :priority => 100, :iso_code => "GIP", :name => "Gibraltar Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit =>
|
|
81
|
-
:gmd => { :priority => 100, :iso_code => "GMD", :name => "Gambian Dalasi", :symbol => "D", :subunit => "Butut", :subunit_to_unit =>
|
|
82
|
-
:gnf => { :priority => 100, :iso_code => "GNF", :name => "Guinean Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
83
|
-
:gtq => { :priority => 100, :iso_code => "GTQ", :name => "Guatemalan Quetzal", :symbol => "Q", :subunit => "Centavo", :subunit_to_unit =>
|
|
84
|
-
:gyd => { :priority => 100, :iso_code => "GYD", :name => "Guyanese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
85
|
-
:hkd => { :priority => 100, :iso_code => "HKD", :name => "Hong Kong Dollar", :symbol => "$", :subunit => "Ho", :subunit_to_unit =>
|
|
86
|
-
:hnl => { :priority => 100, :iso_code => "HNL", :name => "Honduran Lempira", :symbol => "L", :subunit => "Centavo", :subunit_to_unit =>
|
|
87
|
-
:hrk => { :priority => 100, :iso_code => "HRK", :name => "Croatian Kuna", :symbol => "kn", :subunit => "Lipa", :subunit_to_unit =>
|
|
88
|
-
:htg => { :priority => 100, :iso_code => "HTG", :name => "Haitian Gourde", :symbol => "G", :subunit => "Centime", :subunit_to_unit =>
|
|
89
|
-
:huf => { :priority => 100, :iso_code => "HUF", :name => "Hungarian Forint", :symbol => "Ft", :subunit => "Fillér", :subunit_to_unit =>
|
|
90
|
-
:idr => { :priority => 100, :iso_code => "IDR", :name => "Indonesian Rupiah", :symbol => "Rp", :subunit => "Sen", :subunit_to_unit =>
|
|
91
|
-
:ils => { :priority => 100, :iso_code => "ILS", :name => "Israeli New Sheqel", :symbol => "₪", :subunit => "Agora", :subunit_to_unit =>
|
|
92
|
-
:inr => { :priority => 100, :iso_code => "INR", :name => "Indian Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit =>
|
|
93
|
-
:iqd => { :priority => 100, :iso_code => "IQD", :name => "Iraqi Dinar", :symbol => "ع.د", :subunit => "Fils", :subunit_to_unit => "
|
|
94
|
-
:irr => { :priority => 100, :iso_code => "IRR", :name => "Iranian Rial", :symbol => "﷼", :subunit => "Dinar", :subunit_to_unit =>
|
|
95
|
-
:isk => { :priority => 100, :iso_code => "ISK", :name => "Icelandic Króna", :symbol => "kr", :subunit => "Eyrir", :subunit_to_unit =>
|
|
96
|
-
:jmd => { :priority => 100, :iso_code => "JMD", :name => "Jamaican Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
97
|
-
:jod => { :priority => 100, :iso_code => "JOD", :name => "Jordanian Dinar", :symbol => "د.ا", :subunit => "Piastre", :subunit_to_unit =>
|
|
98
|
-
:jpy => { :priority => 6, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit =>
|
|
99
|
-
:kes => { :priority => 100, :iso_code => "KES", :name => "Kenyan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit =>
|
|
100
|
-
:kgs => { :priority => 100, :iso_code => "KGS", :name => "Kyrgyzstani Som", :symbol => nil, :subunit => "Tyiyn", :subunit_to_unit =>
|
|
101
|
-
:khr => { :priority => 100, :iso_code => "KHR", :name => "Cambodian Riel", :symbol => "៛", :subunit => "Sen", :subunit_to_unit =>
|
|
102
|
-
:kmf => { :priority => 100, :iso_code => "KMF", :name => "Comorian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
103
|
-
:kpw => { :priority => 100, :iso_code => "KPW", :name => "North Korean Won", :symbol => "₩", :subunit => "Chŏn", :subunit_to_unit =>
|
|
104
|
-
:krw => { :priority => 100, :iso_code => "KRW", :name => "South Korean Won", :symbol => "₩", :subunit => "Jeon", :subunit_to_unit =>
|
|
105
|
-
:kwd => { :priority => 100, :iso_code => "KWD", :name => "Kuwaiti Dinar", :symbol => "د.ك", :subunit => "Fils", :subunit_to_unit => "
|
|
106
|
-
:kyd => { :priority => 100, :iso_code => "KYD", :name => "Cayman Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
107
|
-
:kzt => { :priority => 100, :iso_code => "KZT", :name => "Kazakhstani Tenge", :symbol => "〒", :subunit => "Tiyn", :subunit_to_unit =>
|
|
108
|
-
:lak => { :priority => 100, :iso_code => "LAK", :name => "Lao Kip", :symbol => "₭", :subunit => "Att", :subunit_to_unit =>
|
|
109
|
-
:lbp => { :priority => 100, :iso_code => "LBP", :name => "Lebanese Lira", :symbol => "ل.ل", :subunit => "Piastre", :subunit_to_unit =>
|
|
110
|
-
:lkr => { :priority => 100, :iso_code => "LKR", :name => "Sri Lankan Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit =>
|
|
111
|
-
:lrd => { :priority => 100, :iso_code => "LRD", :name => "Liberian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
112
|
-
:lsl => { :priority => 100, :iso_code => "LSL", :name => "Lesotho Loti", :symbol => "L", :subunit => "Sente", :subunit_to_unit =>
|
|
113
|
-
:ltl => { :priority => 100, :iso_code => "LTL", :name => "Lithuanian Litas", :symbol => "Lt", :subunit => "Centas", :subunit_to_unit =>
|
|
114
|
-
:lvl => { :priority => 100, :iso_code => "LVL", :name => "Latvian Lats", :symbol => "Ls", :subunit => "Santīms", :subunit_to_unit =>
|
|
115
|
-
:lyd => { :priority => 100, :iso_code => "LYD", :name => "Libyan Dinar", :symbol => "ل.د", :subunit => "Dirham", :subunit_to_unit => "
|
|
116
|
-
:mad => { :priority => 100, :iso_code => "MAD", :name => "Moroccan Dirham", :symbol => "د.م.", :subunit => "Centime", :subunit_to_unit =>
|
|
117
|
-
:mdl => { :priority => 100, :iso_code => "MDL", :name => "Moldovan Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit =>
|
|
118
|
-
:mga => { :priority => 100, :iso_code => "MGA", :name => "Malagasy Ariary", :symbol => nil, :subunit => "Iraimbilanja", :subunit_to_unit =>
|
|
119
|
-
:mkd => { :priority => 100, :iso_code => "MKD", :name => "Macedonian Denar", :symbol => "ден", :subunit => "Deni", :subunit_to_unit =>
|
|
120
|
-
:mmk => { :priority => 100, :iso_code => "MMK", :name => "Myanmar Kyat", :symbol => "K", :subunit => "Pya", :subunit_to_unit =>
|
|
121
|
-
:mnt => { :priority => 100, :iso_code => "MNT", :name => "Mongolian Tögrög", :symbol => "₮", :subunit => "Möngö", :subunit_to_unit =>
|
|
122
|
-
:mop => { :priority => 100, :iso_code => "MOP", :name => "Macanese Pataca", :symbol => "P", :subunit => "Avo", :subunit_to_unit =>
|
|
123
|
-
:mro => { :priority => 100, :iso_code => "MRO", :name => "Mauritanian Ouguiya", :symbol => "UM", :subunit => "Khoums", :subunit_to_unit =>
|
|
124
|
-
:mur => { :priority => 100, :iso_code => "MUR", :name => "Mauritian Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit =>
|
|
125
|
-
:mvr => { :priority => 100, :iso_code => "MVR", :name => "Maldivian Rufiyaa", :symbol => "ރ.", :subunit => "Laari", :subunit_to_unit =>
|
|
126
|
-
:mwk => { :priority => 100, :iso_code => "MWK", :name => "Malawian Kwacha", :symbol => "MK", :subunit => "Tambala", :subunit_to_unit =>
|
|
127
|
-
:mxn => { :priority => 100, :iso_code => "MXN", :name => "Mexican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit =>
|
|
128
|
-
:myr => { :priority => 100, :iso_code => "MYR", :name => "Malaysian Ringgit", :symbol => "RM", :subunit => "Sen", :subunit_to_unit =>
|
|
129
|
-
:mzn => { :priority => 100, :iso_code => "MZN", :name => "Mozambican Metical", :symbol => "MTn", :subunit => "Centavo", :subunit_to_unit =>
|
|
130
|
-
:nad => { :priority => 100, :iso_code => "NAD", :name => "Namibian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
131
|
-
:ngn => { :priority => 100, :iso_code => "NGN", :name => "Nigerian Naira", :symbol => "₦", :subunit => "Kobo", :subunit_to_unit =>
|
|
132
|
-
:nio => { :priority => 100, :iso_code => "NIO", :name => "Nicaraguan Córdoba", :symbol => "C$", :subunit => "Centavo", :subunit_to_unit =>
|
|
133
|
-
:nok => { :priority => 100, :iso_code => "NOK", :name => "Norwegian Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit =>
|
|
134
|
-
:npr => { :priority => 100, :iso_code => "NPR", :name => "Nepalese Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit =>
|
|
135
|
-
:nzd => { :priority => 100, :iso_code => "NZD", :name => "New Zealand Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
136
|
-
:omr => { :priority => 100, :iso_code => "OMR", :name => "Omani Rial", :symbol => "ر.ع.", :subunit => "Baisa", :subunit_to_unit => "
|
|
137
|
-
:pab => { :priority => 100, :iso_code => "PAB", :name => "Panamanian Balboa", :symbol => "B/.", :subunit => "Centésimo", :subunit_to_unit =>
|
|
138
|
-
:pen => { :priority => 100, :iso_code => "PEN", :name => "Peruvian Nuevo Sol", :symbol => "S/.", :subunit => "Céntimo", :subunit_to_unit =>
|
|
139
|
-
:pgk => { :priority => 100, :iso_code => "PGK", :name => "Papua New Guinean Kina", :symbol => "K", :subunit => "Toea", :subunit_to_unit =>
|
|
140
|
-
:php => { :priority => 100, :iso_code => "PHP", :name => "Philippine Peso", :symbol => "₱", :subunit => "Centavo", :subunit_to_unit =>
|
|
141
|
-
:pkr => { :priority => 100, :iso_code => "PKR", :name => "Pakistani Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit =>
|
|
142
|
-
:pln => { :priority => 100, :iso_code => "PLN", :name => "Polish Złoty", :symbol => "zł", :subunit => "Grosz", :subunit_to_unit =>
|
|
143
|
-
:pyg => { :priority => 100, :iso_code => "PYG", :name => "Paraguayan Guaraní", :symbol => "₲", :subunit => "Céntimo", :subunit_to_unit =>
|
|
144
|
-
:qar => { :priority => 100, :iso_code => "QAR", :name => "Qatari Riyal", :symbol => "ر.ق", :subunit => "Dirham", :subunit_to_unit =>
|
|
145
|
-
:ron => { :priority => 100, :iso_code => "RON", :name => "Romanian Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit =>
|
|
146
|
-
:rsd => { :priority => 100, :iso_code => "RSD", :name => "Serbian Dinar", :symbol => "din. or дин.", :subunit => "Para", :subunit_to_unit =>
|
|
147
|
-
:rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "р.", :subunit => "Kopek", :subunit_to_unit =>
|
|
148
|
-
:rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "руб.", :subunit => "Kopek", :subunit_to_unit =>
|
|
149
|
-
:rwf => { :priority => 100, :iso_code => "RWF", :name => "Rwandan Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
150
|
-
:sar => { :priority => 100, :iso_code => "SAR", :name => "Saudi Riyal", :symbol => "ر.س", :subunit => "Hallallah", :subunit_to_unit =>
|
|
151
|
-
:sbd => { :priority => 100, :iso_code => "SBD", :name => "Solomon Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
152
|
-
:scr => { :priority => 100, :iso_code => "SCR", :name => "Seychellois Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit =>
|
|
153
|
-
:sdg => { :priority => 100, :iso_code => "SDG", :name => "Sudanese Pound", :symbol => "£", :subunit => "Piastre", :subunit_to_unit =>
|
|
154
|
-
:sek => { :priority => 100, :iso_code => "SEK", :name => "Swedish Krona", :symbol => "kr", :subunit => "Öre", :subunit_to_unit =>
|
|
155
|
-
:sgd => { :priority => 100, :iso_code => "SGD", :name => "Singapore Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
156
|
-
:shp => { :priority => 100, :iso_code => "SHP", :name => "Saint Helenian Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit =>
|
|
157
|
-
:skk => { :priority => 100, :iso_code => "SKK", :name => "Slovak Koruna", :symbol => "Sk", :subunit => "Halier", :subunit_to_unit =>
|
|
158
|
-
:sll => { :priority => 100, :iso_code => "SLL", :name => "Sierra Leonean Leone", :symbol => "Le", :subunit => "Cent", :subunit_to_unit =>
|
|
159
|
-
:sos => { :priority => 100, :iso_code => "SOS", :name => "Somali Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit =>
|
|
160
|
-
:srd => { :priority => 100, :iso_code => "SRD", :name => "Surinamese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
161
|
-
:std => { :priority => 100, :iso_code => "STD", :name => "São Tomé and Príncipe Dobra", :symbol => "Db", :subunit => "Cêntimo", :subunit_to_unit =>
|
|
162
|
-
:svc => { :priority => 100, :iso_code => "SVC", :name => "Salvadoran Colón", :symbol => "₡", :subunit => "Centavo", :subunit_to_unit =>
|
|
163
|
-
:syp => { :priority => 100, :iso_code => "SYP", :name => "Syrian Pound", :symbol => "£ or ل.س", :subunit => "Piastre", :subunit_to_unit =>
|
|
164
|
-
:szl => { :priority => 100, :iso_code => "SZL", :name => "Swazi Lilangeni", :symbol => "L", :subunit => "Cent", :subunit_to_unit =>
|
|
165
|
-
:thb => { :priority => 100, :iso_code => "THB", :name => "Thai Baht", :symbol => "฿", :subunit => "Satang", :subunit_to_unit =>
|
|
166
|
-
:tjs => { :priority => 100, :iso_code => "TJS", :name => "Tajikistani Somoni", :symbol => "ЅМ", :subunit => "Diram", :subunit_to_unit =>
|
|
167
|
-
:tmm => { :priority => 100, :iso_code => "TMM", :name => "Turkmenistani Manat", :symbol => "m", :subunit => "Tennesi", :subunit_to_unit =>
|
|
168
|
-
:tnd => { :priority => 100, :iso_code => "TND", :name => "Tunisian Dinar", :symbol => "د.ت", :subunit => "Millime", :subunit_to_unit => "
|
|
169
|
-
:top => { :priority => 100, :iso_code => "TOP", :name => "Tongan Paʻanga", :symbol => "T$", :subunit => "Seniti", :subunit_to_unit =>
|
|
170
|
-
:try => { :priority => 100, :iso_code => "TRY", :name => "Turkish New Lira", :symbol => "YTL", :subunit => "New kuruş", :subunit_to_unit =>
|
|
171
|
-
:try => { :priority => 100, :iso_code => "TRY", :name => "Turkish New Lira", :symbol => "₤", :subunit => "New kuruş", :subunit_to_unit =>
|
|
172
|
-
:ttd => { :priority => 100, :iso_code => "TTD", :name => "Trinidad and Tobago Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
173
|
-
:twd => { :priority => 100, :iso_code => "TWD", :name => "New Taiwan Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
174
|
-
:tzs => { :priority => 100, :iso_code => "TZS", :name => "Tanzanian Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit =>
|
|
175
|
-
:uah => { :priority => 100, :iso_code => "UAH", :name => "Ukrainian Hryvnia", :symbol => "₴", :subunit => "Kopiyka", :subunit_to_unit =>
|
|
176
|
-
:ugx => { :priority => 100, :iso_code => "UGX", :name => "Ugandan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit =>
|
|
177
|
-
:usd => { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
178
|
-
:uyu => { :priority => 100, :iso_code => "UYU", :name => "Uruguayan Peso", :symbol => "$", :subunit => "Centésimo", :subunit_to_unit =>
|
|
179
|
-
:uzs => { :priority => 100, :iso_code => "UZS", :name => "Uzbekistani Som", :symbol => nil, :subunit => "Tiyin", :subunit_to_unit =>
|
|
180
|
-
:vef => { :priority => 100, :iso_code => "VEF", :name => "Venezuelan Bolívar", :symbol => "Bs F", :subunit => "Céntimo", :subunit_to_unit =>
|
|
181
|
-
:vnd => { :priority => 100, :iso_code => "VND", :name => "Vietnamese Đồng", :symbol => "₫", :subunit => "Hào", :subunit_to_unit =>
|
|
182
|
-
:vuv => { :priority => 100, :iso_code => "VUV", :name => "Vanuatu Vatu", :symbol => "Vt", :subunit => nil, :subunit_to_unit =>
|
|
183
|
-
:wst => { :priority => 100, :iso_code => "WST", :name => "Samoan Tala", :symbol => "T", :subunit => "Sene", :subunit_to_unit =>
|
|
184
|
-
:xaf => { :priority => 100, :iso_code => "XAF", :name => "Central African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
185
|
-
:xcd => { :priority => 100, :iso_code => "XCD", :name => "East Caribbean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
186
|
-
:xof => { :priority => 100, :iso_code => "XOF", :name => "West African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
187
|
-
:xpf => { :priority => 100, :iso_code => "XPF", :name => "Cfp Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit =>
|
|
188
|
-
:yer => { :priority => 100, :iso_code => "YER", :name => "Yemeni Rial", :symbol => "﷼", :subunit => "Fils", :subunit_to_unit =>
|
|
189
|
-
:zar => { :priority => 100, :iso_code => "ZAR", :name => "South African Rand", :symbol => "R", :subunit => "Cent", :subunit_to_unit =>
|
|
190
|
-
:zmk => { :priority => 100, :iso_code => "ZMK", :name => "Zambian Kwacha", :symbol => "ZK", :subunit => "Ngwee", :subunit_to_unit =>
|
|
191
|
-
:zwd => { :priority => 100, :iso_code => "ZWD", :name => "Zimbabwean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
29
|
+
:aed => { :priority => 100, :iso_code => "AED", :name => "United Arab Emirates Dirham", :symbol => "د.إ", :subunit => "Fils", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
30
|
+
:afn => { :priority => 100, :iso_code => "AFN", :name => "Afghan Afghani", :symbol => "؋", :subunit => "Pul", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
31
|
+
:all => { :priority => 100, :iso_code => "ALL", :name => "Albanian Lek", :symbol => "L", :subunit => "Qintar", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
32
|
+
:amd => { :priority => 100, :iso_code => "AMD", :name => "Armenian Dram", :symbol => "դր.", :subunit => "Luma", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
33
|
+
:ang => { :priority => 100, :iso_code => "ANG", :name => "Netherlands Antillean Gulden", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
34
|
+
:aoa => { :priority => 100, :iso_code => "AOA", :name => "Angolan Kwanza", :symbol => "Kz", :subunit => "Cêntimo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
35
|
+
:ars => { :priority => 100, :iso_code => "ARS", :name => "Argentine Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
36
|
+
:aud => { :priority => 4, :iso_code => "AUD", :name => "Australian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
37
|
+
:awg => { :priority => 100, :iso_code => "AWG", :name => "Aruban Florin", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
38
|
+
:azn => { :priority => 100, :iso_code => "AZN", :name => "Azerbaijani Manat", :symbol => nil, :subunit => "Qəpik", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
39
|
+
:bam => { :priority => 100, :iso_code => "BAM", :name => "Bosnia and Herzegovina Convertible Mark", :symbol => "KM or КМ", :subunit => "Fening", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
40
|
+
:bbd => { :priority => 100, :iso_code => "BBD", :name => "Barbadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
41
|
+
:bdt => { :priority => 100, :iso_code => "BDT", :name => "Bangladeshi Taka", :symbol => "৳", :subunit => "Paisa", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
42
|
+
:bgn => { :priority => 100, :iso_code => "BGN", :name => "Bulgarian Lev", :symbol => "лв", :subunit => "Stotinka", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
43
|
+
:bhd => { :priority => 100, :iso_code => "BHD", :name => "Bahraini Dinar", :symbol => "ب.د", :subunit => "Fils", :subunit_to_unit => 1000, :separator => ".", :delimiter => "," },
|
|
44
|
+
:bif => { :priority => 100, :iso_code => "BIF", :name => "Burundian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
45
|
+
:bmd => { :priority => 100, :iso_code => "BMD", :name => "Bermudian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
46
|
+
:bnd => { :priority => 100, :iso_code => "BND", :name => "Brunei Dollar", :symbol => "$", :subunit => "Sen", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
47
|
+
:bob => { :priority => 100, :iso_code => "BOB", :name => "Bolivian Boliviano", :symbol => "Bs.", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
48
|
+
:brl => { :priority => 100, :iso_code => "BRL", :name => "Brazilian Real", :symbol => "R$ ", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ",", :delimiter => "." },
|
|
49
|
+
:bsd => { :priority => 100, :iso_code => "BSD", :name => "Bahamian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
50
|
+
:btn => { :priority => 100, :iso_code => "BTN", :name => "Bhutanese Ngultrum", :symbol => nil, :subunit => "Chertrum", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
51
|
+
:bwp => { :priority => 100, :iso_code => "BWP", :name => "Botswana Pula", :symbol => "P", :subunit => "Thebe", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
52
|
+
:byr => { :priority => 100, :iso_code => "BYR", :name => "Belarusian Ruble", :symbol => "Br", :subunit => "Kapyeyka", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
53
|
+
:bzd => { :priority => 100, :iso_code => "BZD", :name => "Belize Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
54
|
+
:cad => { :priority => 5, :iso_code => "CAD", :name => "Canadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
55
|
+
:cdf => { :priority => 100, :iso_code => "CDF", :name => "Congolese Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
56
|
+
:chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
57
|
+
:chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
58
|
+
:clp => { :priority => 100, :iso_code => "CLP", :name => "Chilean Peso", :symbol => "$", :subunit => "Peso", :subunit_to_unit => 1, :separator => ",", :delimiter => "." },
|
|
59
|
+
:cny => { :priority => 100, :iso_code => "CNY", :name => "Chinese Renminbi Yuan", :symbol => "¥", :subunit => "Jiao", :subunit_to_unit => 10, :separator => ".", :delimiter => "," },
|
|
60
|
+
:cop => { :priority => 100, :iso_code => "COP", :name => "Colombian Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
61
|
+
:crc => { :priority => 100, :iso_code => "CRC", :name => "Costa Rican Colón", :symbol => "₡", :subunit => "Céntimo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
62
|
+
:cuc => { :priority => 100, :iso_code => "CUC", :name => "Cuban Convertible Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
63
|
+
:cup => { :priority => 100, :iso_code => "CUP", :name => "Cuban Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
64
|
+
:cve => { :priority => 100, :iso_code => "CVE", :name => "Cape Verdean Escudo", :symbol => "$ or Esc", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
65
|
+
:czk => { :priority => 100, :iso_code => "CZK", :name => "Czech Koruna", :symbol => "Kč", :subunit => "Haléř", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
66
|
+
:djf => { :priority => 100, :iso_code => "DJF", :name => "Djiboutian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
67
|
+
:dkk => { :priority => 100, :iso_code => "DKK", :name => "Danish Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
68
|
+
:dop => { :priority => 100, :iso_code => "DOP", :name => "Dominican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
69
|
+
:dzd => { :priority => 100, :iso_code => "DZD", :name => "Algerian Dinar", :symbol => "د.ج", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
70
|
+
:eek => { :priority => 100, :iso_code => "EEK", :name => "Estonian Kroon", :symbol => "KR", :subunit => "Sent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
71
|
+
:egp => { :priority => 100, :iso_code => "EGP", :name => "Egyptian Pound", :symbol => "£ or ج.م", :subunit => "Piastre", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
72
|
+
:ern => { :priority => 100, :iso_code => "ERN", :name => "Eritrean Nakfa", :symbol => "Nfk", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
73
|
+
:etb => { :priority => 100, :iso_code => "ETB", :name => "Ethiopian Birr", :symbol => nil, :subunit => "Santim", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
74
|
+
:eur => { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
75
|
+
:fjd => { :priority => 100, :iso_code => "FJD", :name => "Fijian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
76
|
+
:fkp => { :priority => 100, :iso_code => "FKP", :name => "Falkland Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
77
|
+
:gbp => { :priority => 3, :iso_code => "GBP", :name => "British Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
78
|
+
:gel => { :priority => 100, :iso_code => "GEL", :name => "Georgian Lari", :symbol => "ლ", :subunit => "Tetri", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
79
|
+
:ghc => { :priority => 100, :iso_code => "GHC", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
80
|
+
:gip => { :priority => 100, :iso_code => "GIP", :name => "Gibraltar Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
81
|
+
:gmd => { :priority => 100, :iso_code => "GMD", :name => "Gambian Dalasi", :symbol => "D", :subunit => "Butut", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
82
|
+
:gnf => { :priority => 100, :iso_code => "GNF", :name => "Guinean Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
83
|
+
:gtq => { :priority => 100, :iso_code => "GTQ", :name => "Guatemalan Quetzal", :symbol => "Q", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
84
|
+
:gyd => { :priority => 100, :iso_code => "GYD", :name => "Guyanese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
85
|
+
:hkd => { :priority => 100, :iso_code => "HKD", :name => "Hong Kong Dollar", :symbol => "$", :subunit => "Ho", :subunit_to_unit => 10, :separator => ".", :delimiter => "," },
|
|
86
|
+
:hnl => { :priority => 100, :iso_code => "HNL", :name => "Honduran Lempira", :symbol => "L", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
87
|
+
:hrk => { :priority => 100, :iso_code => "HRK", :name => "Croatian Kuna", :symbol => "kn", :subunit => "Lipa", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
88
|
+
:htg => { :priority => 100, :iso_code => "HTG", :name => "Haitian Gourde", :symbol => "G", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
89
|
+
:huf => { :priority => 100, :iso_code => "HUF", :name => "Hungarian Forint", :symbol => "Ft", :subunit => "Fillér", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
90
|
+
:idr => { :priority => 100, :iso_code => "IDR", :name => "Indonesian Rupiah", :symbol => "Rp", :subunit => "Sen", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
91
|
+
:ils => { :priority => 100, :iso_code => "ILS", :name => "Israeli New Sheqel", :symbol => "₪", :subunit => "Agora", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
92
|
+
:inr => { :priority => 100, :iso_code => "INR", :name => "Indian Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
93
|
+
:iqd => { :priority => 100, :iso_code => "IQD", :name => "Iraqi Dinar", :symbol => "ع.د", :subunit => "Fils", :subunit_to_unit => 1000, :separator => ".", :delimiter => "," },
|
|
94
|
+
:irr => { :priority => 100, :iso_code => "IRR", :name => "Iranian Rial", :symbol => "﷼", :subunit => "Dinar", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
95
|
+
:isk => { :priority => 100, :iso_code => "ISK", :name => "Icelandic Króna", :symbol => "kr", :subunit => "Eyrir", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
96
|
+
:jmd => { :priority => 100, :iso_code => "JMD", :name => "Jamaican Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
97
|
+
:jod => { :priority => 100, :iso_code => "JOD", :name => "Jordanian Dinar", :symbol => "د.ا", :subunit => "Piastre", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
98
|
+
:jpy => { :priority => 6, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
99
|
+
:kes => { :priority => 100, :iso_code => "KES", :name => "Kenyan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
100
|
+
:kgs => { :priority => 100, :iso_code => "KGS", :name => "Kyrgyzstani Som", :symbol => nil, :subunit => "Tyiyn", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
101
|
+
:khr => { :priority => 100, :iso_code => "KHR", :name => "Cambodian Riel", :symbol => "៛", :subunit => "Sen", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
102
|
+
:kmf => { :priority => 100, :iso_code => "KMF", :name => "Comorian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
103
|
+
:kpw => { :priority => 100, :iso_code => "KPW", :name => "North Korean Won", :symbol => "₩", :subunit => "Chŏn", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
104
|
+
:krw => { :priority => 100, :iso_code => "KRW", :name => "South Korean Won", :symbol => "₩", :subunit => "Jeon", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
105
|
+
:kwd => { :priority => 100, :iso_code => "KWD", :name => "Kuwaiti Dinar", :symbol => "د.ك", :subunit => "Fils", :subunit_to_unit => 1000, :separator => ".", :delimiter => "," },
|
|
106
|
+
:kyd => { :priority => 100, :iso_code => "KYD", :name => "Cayman Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
107
|
+
:kzt => { :priority => 100, :iso_code => "KZT", :name => "Kazakhstani Tenge", :symbol => "〒", :subunit => "Tiyn", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
108
|
+
:lak => { :priority => 100, :iso_code => "LAK", :name => "Lao Kip", :symbol => "₭", :subunit => "Att", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
109
|
+
:lbp => { :priority => 100, :iso_code => "LBP", :name => "Lebanese Lira", :symbol => "ل.ل", :subunit => "Piastre", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
110
|
+
:lkr => { :priority => 100, :iso_code => "LKR", :name => "Sri Lankan Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
111
|
+
:lrd => { :priority => 100, :iso_code => "LRD", :name => "Liberian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
112
|
+
:lsl => { :priority => 100, :iso_code => "LSL", :name => "Lesotho Loti", :symbol => "L", :subunit => "Sente", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
113
|
+
:ltl => { :priority => 100, :iso_code => "LTL", :name => "Lithuanian Litas", :symbol => "Lt", :subunit => "Centas", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
114
|
+
:lvl => { :priority => 100, :iso_code => "LVL", :name => "Latvian Lats", :symbol => "Ls", :subunit => "Santīms", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
115
|
+
:lyd => { :priority => 100, :iso_code => "LYD", :name => "Libyan Dinar", :symbol => "ل.د", :subunit => "Dirham", :subunit_to_unit => 1000, :separator => ".", :delimiter => "," },
|
|
116
|
+
:mad => { :priority => 100, :iso_code => "MAD", :name => "Moroccan Dirham", :symbol => "د.م.", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
117
|
+
:mdl => { :priority => 100, :iso_code => "MDL", :name => "Moldovan Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
118
|
+
:mga => { :priority => 100, :iso_code => "MGA", :name => "Malagasy Ariary", :symbol => nil, :subunit => "Iraimbilanja", :subunit_to_unit => 5, :separator => ".", :delimiter => "," },
|
|
119
|
+
:mkd => { :priority => 100, :iso_code => "MKD", :name => "Macedonian Denar", :symbol => "ден", :subunit => "Deni", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
120
|
+
:mmk => { :priority => 100, :iso_code => "MMK", :name => "Myanmar Kyat", :symbol => "K", :subunit => "Pya", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
121
|
+
:mnt => { :priority => 100, :iso_code => "MNT", :name => "Mongolian Tögrög", :symbol => "₮", :subunit => "Möngö", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
122
|
+
:mop => { :priority => 100, :iso_code => "MOP", :name => "Macanese Pataca", :symbol => "P", :subunit => "Avo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
123
|
+
:mro => { :priority => 100, :iso_code => "MRO", :name => "Mauritanian Ouguiya", :symbol => "UM", :subunit => "Khoums", :subunit_to_unit => 5, :separator => ".", :delimiter => "," },
|
|
124
|
+
:mur => { :priority => 100, :iso_code => "MUR", :name => "Mauritian Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
125
|
+
:mvr => { :priority => 100, :iso_code => "MVR", :name => "Maldivian Rufiyaa", :symbol => "ރ.", :subunit => "Laari", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
126
|
+
:mwk => { :priority => 100, :iso_code => "MWK", :name => "Malawian Kwacha", :symbol => "MK", :subunit => "Tambala", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
127
|
+
:mxn => { :priority => 100, :iso_code => "MXN", :name => "Mexican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
128
|
+
:myr => { :priority => 100, :iso_code => "MYR", :name => "Malaysian Ringgit", :symbol => "RM", :subunit => "Sen", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
129
|
+
:mzn => { :priority => 100, :iso_code => "MZN", :name => "Mozambican Metical", :symbol => "MTn", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
130
|
+
:nad => { :priority => 100, :iso_code => "NAD", :name => "Namibian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
131
|
+
:ngn => { :priority => 100, :iso_code => "NGN", :name => "Nigerian Naira", :symbol => "₦", :subunit => "Kobo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
132
|
+
:nio => { :priority => 100, :iso_code => "NIO", :name => "Nicaraguan Córdoba", :symbol => "C$", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
133
|
+
:nok => { :priority => 100, :iso_code => "NOK", :name => "Norwegian Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
134
|
+
:npr => { :priority => 100, :iso_code => "NPR", :name => "Nepalese Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
135
|
+
:nzd => { :priority => 100, :iso_code => "NZD", :name => "New Zealand Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
136
|
+
:omr => { :priority => 100, :iso_code => "OMR", :name => "Omani Rial", :symbol => "ر.ع.", :subunit => "Baisa", :subunit_to_unit => 1000, :separator => ".", :delimiter => "," },
|
|
137
|
+
:pab => { :priority => 100, :iso_code => "PAB", :name => "Panamanian Balboa", :symbol => "B/.", :subunit => "Centésimo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
138
|
+
:pen => { :priority => 100, :iso_code => "PEN", :name => "Peruvian Nuevo Sol", :symbol => "S/.", :subunit => "Céntimo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
139
|
+
:pgk => { :priority => 100, :iso_code => "PGK", :name => "Papua New Guinean Kina", :symbol => "K", :subunit => "Toea", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
140
|
+
:php => { :priority => 100, :iso_code => "PHP", :name => "Philippine Peso", :symbol => "₱", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
141
|
+
:pkr => { :priority => 100, :iso_code => "PKR", :name => "Pakistani Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
142
|
+
:pln => { :priority => 100, :iso_code => "PLN", :name => "Polish Złoty", :symbol => "zł", :subunit => "Grosz", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
143
|
+
:pyg => { :priority => 100, :iso_code => "PYG", :name => "Paraguayan Guaraní", :symbol => "₲", :subunit => "Céntimo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
144
|
+
:qar => { :priority => 100, :iso_code => "QAR", :name => "Qatari Riyal", :symbol => "ر.ق", :subunit => "Dirham", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
145
|
+
:ron => { :priority => 100, :iso_code => "RON", :name => "Romanian Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
146
|
+
:rsd => { :priority => 100, :iso_code => "RSD", :name => "Serbian Dinar", :symbol => "din. or дин.", :subunit => "Para", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
147
|
+
:rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "р.", :subunit => "Kopek", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
148
|
+
:rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "руб.", :subunit => "Kopek", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
149
|
+
:rwf => { :priority => 100, :iso_code => "RWF", :name => "Rwandan Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
150
|
+
:sar => { :priority => 100, :iso_code => "SAR", :name => "Saudi Riyal", :symbol => "ر.س", :subunit => "Hallallah", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
151
|
+
:sbd => { :priority => 100, :iso_code => "SBD", :name => "Solomon Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
152
|
+
:scr => { :priority => 100, :iso_code => "SCR", :name => "Seychellois Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
153
|
+
:sdg => { :priority => 100, :iso_code => "SDG", :name => "Sudanese Pound", :symbol => "£", :subunit => "Piastre", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
154
|
+
:sek => { :priority => 100, :iso_code => "SEK", :name => "Swedish Krona", :symbol => "kr", :subunit => "Öre", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
155
|
+
:sgd => { :priority => 100, :iso_code => "SGD", :name => "Singapore Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
156
|
+
:shp => { :priority => 100, :iso_code => "SHP", :name => "Saint Helenian Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
157
|
+
:skk => { :priority => 100, :iso_code => "SKK", :name => "Slovak Koruna", :symbol => "Sk", :subunit => "Halier", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
158
|
+
:sll => { :priority => 100, :iso_code => "SLL", :name => "Sierra Leonean Leone", :symbol => "Le", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
159
|
+
:sos => { :priority => 100, :iso_code => "SOS", :name => "Somali Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
160
|
+
:srd => { :priority => 100, :iso_code => "SRD", :name => "Surinamese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
161
|
+
:std => { :priority => 100, :iso_code => "STD", :name => "São Tomé and Príncipe Dobra", :symbol => "Db", :subunit => "Cêntimo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
162
|
+
:svc => { :priority => 100, :iso_code => "SVC", :name => "Salvadoran Colón", :symbol => "₡", :subunit => "Centavo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
163
|
+
:syp => { :priority => 100, :iso_code => "SYP", :name => "Syrian Pound", :symbol => "£ or ل.س", :subunit => "Piastre", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
164
|
+
:szl => { :priority => 100, :iso_code => "SZL", :name => "Swazi Lilangeni", :symbol => "L", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
165
|
+
:thb => { :priority => 100, :iso_code => "THB", :name => "Thai Baht", :symbol => "฿", :subunit => "Satang", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
166
|
+
:tjs => { :priority => 100, :iso_code => "TJS", :name => "Tajikistani Somoni", :symbol => "ЅМ", :subunit => "Diram", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
167
|
+
:tmm => { :priority => 100, :iso_code => "TMM", :name => "Turkmenistani Manat", :symbol => "m", :subunit => "Tennesi", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
168
|
+
:tnd => { :priority => 100, :iso_code => "TND", :name => "Tunisian Dinar", :symbol => "د.ت", :subunit => "Millime", :subunit_to_unit => 1000, :separator => ".", :delimiter => "," },
|
|
169
|
+
:top => { :priority => 100, :iso_code => "TOP", :name => "Tongan Paʻanga", :symbol => "T$", :subunit => "Seniti", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
170
|
+
:try => { :priority => 100, :iso_code => "TRY", :name => "Turkish New Lira", :symbol => "YTL", :subunit => "New kuruş", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
171
|
+
:try => { :priority => 100, :iso_code => "TRY", :name => "Turkish New Lira", :symbol => "₤", :subunit => "New kuruş", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
172
|
+
:ttd => { :priority => 100, :iso_code => "TTD", :name => "Trinidad and Tobago Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
173
|
+
:twd => { :priority => 100, :iso_code => "TWD", :name => "New Taiwan Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
174
|
+
:tzs => { :priority => 100, :iso_code => "TZS", :name => "Tanzanian Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
175
|
+
:uah => { :priority => 100, :iso_code => "UAH", :name => "Ukrainian Hryvnia", :symbol => "₴", :subunit => "Kopiyka", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
176
|
+
:ugx => { :priority => 100, :iso_code => "UGX", :name => "Ugandan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
177
|
+
:usd => { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
178
|
+
:uyu => { :priority => 100, :iso_code => "UYU", :name => "Uruguayan Peso", :symbol => "$", :subunit => "Centésimo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
179
|
+
:uzs => { :priority => 100, :iso_code => "UZS", :name => "Uzbekistani Som", :symbol => nil, :subunit => "Tiyin", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
180
|
+
:vef => { :priority => 100, :iso_code => "VEF", :name => "Venezuelan Bolívar", :symbol => "Bs F", :subunit => "Céntimo", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
181
|
+
:vnd => { :priority => 100, :iso_code => "VND", :name => "Vietnamese Đồng", :symbol => "₫", :subunit => "Hào", :subunit_to_unit => 10, :separator => ".", :delimiter => "," },
|
|
182
|
+
:vuv => { :priority => 100, :iso_code => "VUV", :name => "Vanuatu Vatu", :symbol => "Vt", :subunit => nil, :subunit_to_unit => 1, :separator => ".", :delimiter => "," },
|
|
183
|
+
:wst => { :priority => 100, :iso_code => "WST", :name => "Samoan Tala", :symbol => "T", :subunit => "Sene", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
184
|
+
:xaf => { :priority => 100, :iso_code => "XAF", :name => "Central African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
185
|
+
:xcd => { :priority => 100, :iso_code => "XCD", :name => "East Caribbean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
186
|
+
:xof => { :priority => 100, :iso_code => "XOF", :name => "West African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
187
|
+
:xpf => { :priority => 100, :iso_code => "XPF", :name => "Cfp Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
188
|
+
:yer => { :priority => 100, :iso_code => "YER", :name => "Yemeni Rial", :symbol => "﷼", :subunit => "Fils", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
189
|
+
:zar => { :priority => 100, :iso_code => "ZAR", :name => "South African Rand", :symbol => "R", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
190
|
+
:zmk => { :priority => 100, :iso_code => "ZMK", :name => "Zambian Kwacha", :symbol => "ZK", :subunit => "Ngwee", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
191
|
+
:zwd => { :priority => 100, :iso_code => "ZWD", :name => "Zimbabwean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
192
192
|
|
|
193
193
|
# aliases for BC with documentation before Currency
|
|
194
|
-
:yen => { :priority => 100, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit =>
|
|
194
|
+
:yen => { :priority => 100, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :separator => ".", :delimiter => "," },
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
attr_reader :id, *ATTRIBUTES
|
data/lib/money/defaults.rb
CHANGED
|
@@ -41,17 +41,17 @@ class Money
|
|
|
41
41
|
"SEK" => "kr",
|
|
42
42
|
"GHC" => "¢",
|
|
43
43
|
"BRL" => "R$ ",
|
|
44
|
-
# Everything else defaults to '
|
|
44
|
+
# Everything else defaults to '¤'
|
|
45
45
|
}, "Money::SYMBOLS has no longer effect. See Money::Currency#symbol.")
|
|
46
46
|
|
|
47
|
-
SEPARATORS = {
|
|
47
|
+
SEPARATORS = DeprecatedHash.new({
|
|
48
48
|
"BRL" => ",",
|
|
49
49
|
# Everything else defaults to '.'
|
|
50
|
-
}
|
|
50
|
+
}, "Money::SEPARATORS is deprecated. See Money::Currency#separator.")
|
|
51
51
|
|
|
52
|
-
DELIMITERS = {
|
|
52
|
+
DELIMITERS = DeprecatedHash.new({
|
|
53
53
|
"BRL" => ".",
|
|
54
54
|
# Everything else defaults to ","
|
|
55
|
-
}
|
|
55
|
+
}, "Money::DELIMITERS is deprecated. See Money::Currency#delimiter.")
|
|
56
56
|
|
|
57
57
|
end
|
data/lib/money/money.rb
CHANGED
|
@@ -218,6 +218,11 @@ class Money
|
|
|
218
218
|
a.modulo(b) - (b.is_a?(Money) ? b : Money.new(b, a.currency))
|
|
219
219
|
end
|
|
220
220
|
|
|
221
|
+
# Return absolute value of self as a new Money object
|
|
222
|
+
def abs
|
|
223
|
+
Money.new(self.cents.abs, self.currency)
|
|
224
|
+
end
|
|
225
|
+
|
|
221
226
|
# Test if the money amount is zero
|
|
222
227
|
def zero?
|
|
223
228
|
cents == 0
|
|
@@ -232,25 +237,21 @@ class Money
|
|
|
232
237
|
# Attempts to pick a symbol that's suitable for the given currency
|
|
233
238
|
# looking up the Currency::TABLE hashtable.
|
|
234
239
|
# If the symbol for the given currency isn't known,
|
|
235
|
-
# then it will default to "
|
|
240
|
+
# then it will default to "¤".
|
|
236
241
|
def symbol
|
|
237
|
-
currency.symbol || "
|
|
242
|
+
currency.symbol || "¤"
|
|
238
243
|
end
|
|
239
244
|
|
|
240
|
-
#
|
|
241
|
-
#
|
|
242
|
-
# If the symbol for the given currency isn't known,
|
|
243
|
-
# then it will default to ",".
|
|
245
|
+
# Uses :delimiter from the Currency hash. If it is not specified defaults to
|
|
246
|
+
# ",".
|
|
244
247
|
def delimiter
|
|
245
|
-
|
|
248
|
+
currency.delimiter || ","
|
|
246
249
|
end
|
|
247
250
|
|
|
248
|
-
#
|
|
249
|
-
#
|
|
250
|
-
# If the separator for the given currency isn't known,
|
|
251
|
-
# then it will default to ".".
|
|
251
|
+
# Uses :separator from the Currency Hash. If it is not specified defaults to
|
|
252
|
+
# ".".
|
|
252
253
|
def separator
|
|
253
|
-
|
|
254
|
+
currency.separator || "."
|
|
254
255
|
end
|
|
255
256
|
|
|
256
257
|
# Creates a formatted price string according to several rules. The following
|
|
@@ -307,9 +308,9 @@ class Money
|
|
|
307
308
|
#
|
|
308
309
|
#
|
|
309
310
|
# If the symbol for the given currency isn't known, then it will default
|
|
310
|
-
# to "
|
|
311
|
+
# to "¤" as symbol:
|
|
311
312
|
#
|
|
312
|
-
# Money.new(100, "AWG").format(:symbol => true) => "
|
|
313
|
+
# Money.new(100, "AWG").format(:symbol => true) => "¤1.00"
|
|
313
314
|
#
|
|
314
315
|
# You can specify a string as value to enforce using a particular symbol:
|
|
315
316
|
#
|
|
@@ -377,10 +378,10 @@ class Money
|
|
|
377
378
|
symbol_value = symbol
|
|
378
379
|
end
|
|
379
380
|
|
|
380
|
-
if rules[:no_cents]
|
|
381
|
-
formatted = sprintf("#{symbol_value}%d", cents.to_f /
|
|
381
|
+
if rules[:no_cents] or currency.subunit_to_unit == 1
|
|
382
|
+
formatted = sprintf("#{symbol_value}%d", cents.to_f / currency.subunit_to_unit)
|
|
382
383
|
else
|
|
383
|
-
formatted = sprintf("#{symbol_value}%.2f", cents.to_f /
|
|
384
|
+
formatted = sprintf("#{symbol_value}%.2f", cents.to_f / currency.subunit_to_unit)
|
|
384
385
|
end
|
|
385
386
|
|
|
386
387
|
delimiter_value = delimiter
|
|
@@ -419,7 +420,8 @@ class Money
|
|
|
419
420
|
# Money.ca_dollar(100).to_s => "1.00"
|
|
420
421
|
#
|
|
421
422
|
def to_s
|
|
422
|
-
sprintf("
|
|
423
|
+
return sprintf("%d", cents) if currency.subunit_to_unit == 1
|
|
424
|
+
sprintf("%.2f", cents.to_f / currency.subunit_to_unit)
|
|
423
425
|
end
|
|
424
426
|
|
|
425
427
|
# Return the amount of money as a float. Floating points cannot guarantee
|
|
@@ -430,7 +432,7 @@ class Money
|
|
|
430
432
|
# Money.us_dollar(100).to_f => 1.0
|
|
431
433
|
#
|
|
432
434
|
def to_f
|
|
433
|
-
cents /
|
|
435
|
+
cents.to_f / currency.subunit_to_unit
|
|
434
436
|
end
|
|
435
437
|
|
|
436
438
|
# Receive the amount of this money object in another Currency.
|
|
@@ -27,9 +27,10 @@ class Money
|
|
|
27
27
|
@@singleton
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def initialize
|
|
30
|
+
def initialize(&block)
|
|
31
31
|
@rates = {}
|
|
32
32
|
@mutex = Mutex.new
|
|
33
|
+
@rounding_method = block
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
# Registers a conversion rate. +from+ and +to+ are both currency names.
|
|
@@ -60,12 +61,20 @@ class Money
|
|
|
60
61
|
# Returns the amount of cents in +to_currency+ as an integer, rounded down.
|
|
61
62
|
#
|
|
62
63
|
# If the conversion rate is unknown, then Money::UnknownRate will be raised.
|
|
63
|
-
def exchange(cents, from_currency, to_currency)
|
|
64
|
+
def exchange(cents, from_currency, to_currency, &block)
|
|
64
65
|
rate = get_rate(from_currency, to_currency)
|
|
65
66
|
if !rate
|
|
66
67
|
raise Money::UnknownRate, "No conversion rate known for '#{from_currency}' -> '#{to_currency}'"
|
|
67
68
|
end
|
|
68
|
-
|
|
69
|
+
_from_currency_ = Currency.wrap(from_currency)
|
|
70
|
+
_to_currency_ = Currency.wrap(to_currency)
|
|
71
|
+
|
|
72
|
+
_cents_ = cents / (_from_currency_.subunit_to_unit.to_f / _to_currency_.subunit_to_unit.to_f)
|
|
73
|
+
|
|
74
|
+
ex = _cents_ * rate
|
|
75
|
+
return block.call(ex) if block_given?
|
|
76
|
+
return @rounding_method.call(ex) unless @rounding_method.nil?
|
|
77
|
+
ex.to_s.to_i
|
|
69
78
|
end
|
|
70
79
|
|
|
71
80
|
@@singleton = VariableExchangeBank.new
|
data/money.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{money}
|
|
8
|
-
s.version = "3.0.
|
|
8
|
+
s.version = "3.0.5"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Tobias Luetke", "Hongli Lai", "Jeremy McNevin", "Shane Emmons"]
|
|
12
|
-
s.date = %q{2010-
|
|
12
|
+
s.date = %q{2010-07-16}
|
|
13
13
|
s.description = %q{Money and currency exchange support library.}
|
|
14
14
|
s.email = %q{hongli@phusion.nl}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -17,6 +17,17 @@ describe "Money core extensions" do
|
|
|
17
17
|
money.cents.should == 1234_00
|
|
18
18
|
money.currency.should == Money.default_currency
|
|
19
19
|
end
|
|
20
|
+
|
|
21
|
+
specify "Numeric#to_money accepts optional currency" do
|
|
22
|
+
1234.to_money('USD').should == Money.new(123400, 'USD')
|
|
23
|
+
1234.to_money('EUR').should == Money.new(123400, 'EUR')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
specify "Numeric#to_money should respect :subunit_to_unit" do
|
|
27
|
+
10.to_money('USD').should == Money.new(10_00, 'USD')
|
|
28
|
+
10.to_money('TND').should == Money.new(10_000, 'TND')
|
|
29
|
+
10.to_money('CLP').should == Money.new(10, 'CLP')
|
|
30
|
+
end
|
|
20
31
|
|
|
21
32
|
specify "String#to_money works" do
|
|
22
33
|
"20.15".to_money.should == Money.new(20_15)
|
|
@@ -73,6 +84,13 @@ describe "Money core extensions" do
|
|
|
73
84
|
"$1.99000 USD".to_money.should == Money.new(1_99, "USD")
|
|
74
85
|
end
|
|
75
86
|
|
|
87
|
+
specify "String#to_money should accept optional currency" do
|
|
88
|
+
"10.10".to_money('USD').should == Money.new(1010, 'USD')
|
|
89
|
+
"10.10".to_money('EUR').should == Money.new(1010, 'EUR')
|
|
90
|
+
"10.10 USD".to_money('USD').should == Money.new(1010, 'USD')
|
|
91
|
+
lambda{"10.10 USD".to_money('EUR')}.should raise_error
|
|
92
|
+
end
|
|
93
|
+
|
|
76
94
|
specify "String#to_money ignores unrecognized data" do
|
|
77
95
|
"hello 2000 world".to_money.should == Money.new(2000_00)
|
|
78
96
|
end
|
data/test/currency_spec.rb
CHANGED
|
@@ -10,14 +10,16 @@ describe Money::Currency do
|
|
|
10
10
|
|
|
11
11
|
specify "#initialize should lookup data from TABLE" do
|
|
12
12
|
with_custom_definitions do
|
|
13
|
-
Money::Currency::TABLE[:usd] = { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
14
|
-
Money::Currency::TABLE[:eur] = { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit =>
|
|
13
|
+
Money::Currency::TABLE[:usd] = { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," }
|
|
14
|
+
Money::Currency::TABLE[:eur] = { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," }
|
|
15
15
|
|
|
16
16
|
currency = Money::Currency.new("USD")
|
|
17
17
|
currency.id.should == :usd
|
|
18
18
|
currency.priority.should == 1
|
|
19
19
|
currency.iso_code.should == "USD"
|
|
20
20
|
currency.name.should == "United States Dollar"
|
|
21
|
+
currency.separator.should == "."
|
|
22
|
+
currency.delimiter.should == ","
|
|
21
23
|
end
|
|
22
24
|
end
|
|
23
25
|
|
|
@@ -47,14 +49,14 @@ describe Money::Currency do
|
|
|
47
49
|
|
|
48
50
|
specify "#inspect" do
|
|
49
51
|
Money::Currency.new(:usd).inspect.should ==
|
|
50
|
-
%Q{#<Money::Currency id: usd priority: 1, iso_code: USD, name: United States Dollar, symbol: $, subunit: Cent, subunit_to_unit: 100
|
|
52
|
+
%Q{#<Money::Currency id: usd priority: 1, iso_code: USD, name: United States Dollar, symbol: $, subunit: Cent, subunit_to_unit: 100, separator: ., delimiter: ,>}
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
|
|
54
56
|
specify "#self.find should return currency matching given id" do
|
|
55
57
|
with_custom_definitions do
|
|
56
|
-
Money::Currency::TABLE[:usd] = { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
57
|
-
Money::Currency::TABLE[:eur] = { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit =>
|
|
58
|
+
Money::Currency::TABLE[:usd] = { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," }
|
|
59
|
+
Money::Currency::TABLE[:eur] = { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," }
|
|
58
60
|
|
|
59
61
|
expected = Money::Currency.new(:eur)
|
|
60
62
|
Money::Currency.find(:eur).should == expected
|
|
@@ -66,8 +68,8 @@ describe Money::Currency do
|
|
|
66
68
|
|
|
67
69
|
specify "#self.find should return nil unless currency matching given id" do
|
|
68
70
|
with_custom_definitions do
|
|
69
|
-
Money::Currency::TABLE[:usd] = { :position => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit =>
|
|
70
|
-
Money::Currency::TABLE[:eur] = { :position => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit =>
|
|
71
|
+
Money::Currency::TABLE[:usd] = { :position => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," }
|
|
72
|
+
Money::Currency::TABLE[:eur] = { :position => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :separator => ".", :delimiter => "," }
|
|
71
73
|
|
|
72
74
|
expected = Money::Currency.new(:eur)
|
|
73
75
|
Money::Currency.find(:eur).should == expected
|
data/test/exchange_bank_spec.rb
CHANGED
|
@@ -42,4 +42,60 @@ describe Money::VariableExchangeBank do
|
|
|
42
42
|
block = lambda { @bank.exchange(10, "USD", "EUR") }
|
|
43
43
|
block.should raise_error(Money::UnknownRate)
|
|
44
44
|
end
|
|
45
|
+
|
|
46
|
+
describe '.exchange' do
|
|
47
|
+
context 'sterling to euros using a rate of 1.39' do
|
|
48
|
+
it 'returns the correct amount' do
|
|
49
|
+
@bank.add_rate('GBP', 'EUR', 1.38)
|
|
50
|
+
@bank.exchange(10000, 'GBP', 'EUR').should == 13800
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
context 'dollars to euros using a rate of 0.86' do
|
|
55
|
+
it 'returns the correct amount' do
|
|
56
|
+
@bank.add_rate('USD', 'EUR', 0.86)
|
|
57
|
+
@bank.exchange(10000, 'USD', 'EUR').should == 8600
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context 'TND to USD using a rate of 0.67138' do
|
|
62
|
+
it 'returns the correct amount' do
|
|
63
|
+
@bank.add_rate('TND', 'USD', 0.67138)
|
|
64
|
+
@bank.exchange(1000, 'TND', 'USD').should == 67
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context 'USD to TND using a rate of 1.32862' do
|
|
69
|
+
it 'returns the correct amount' do
|
|
70
|
+
@bank.add_rate('USD', 'TND', 1.32862)
|
|
71
|
+
@bank.exchange(1000, 'USD', 'TND').should == 13286
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
context 'using custom rounding methods' do
|
|
77
|
+
describe 'passing a rounding method to #new' do
|
|
78
|
+
before :each do
|
|
79
|
+
mth = Proc.new{|ex| ex.ceil }
|
|
80
|
+
@bank = Money::VariableExchangeBank.new(&mth)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'should use @rounding_method' do
|
|
84
|
+
@bank.add_rate('USD', 'EUR', 0.86)
|
|
85
|
+
@bank.exchange(10, 'USD', 'EUR').should == 9
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe 'passing a rounding method to #exchange' do
|
|
90
|
+
it 'should use &block' do
|
|
91
|
+
@bank.add_rate('USD', 'EUR', 0.86)
|
|
92
|
+
@bank.exchange(10, 'USD', 'EUR').should == 8
|
|
93
|
+
|
|
94
|
+
mth = Proc.new{|ex| ex.ceil }
|
|
95
|
+
@bank.exchange(10, 'USD', 'EUR', &mth).should == 9
|
|
96
|
+
|
|
97
|
+
@bank.exchange(10, 'USD', 'EUR'){|ex| ex.ceil }.should == 9
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
45
101
|
end
|
data/test/money_spec.rb
CHANGED
|
@@ -430,6 +430,12 @@ describe Money do
|
|
|
430
430
|
end
|
|
431
431
|
end
|
|
432
432
|
|
|
433
|
+
specify "#abs correctly returns the absolute value as a new Money object" do
|
|
434
|
+
n = Money.new(-1, :USD)
|
|
435
|
+
n.abs.should == Money.new( 1, :USD)
|
|
436
|
+
n.should == Money.new(-1, :USD)
|
|
437
|
+
end
|
|
438
|
+
|
|
433
439
|
specify "Money.empty creates a new Money object of 0 cents" do
|
|
434
440
|
Money.empty.should == Money.new(0)
|
|
435
441
|
end
|
|
@@ -463,15 +469,35 @@ describe Money do
|
|
|
463
469
|
Money.new(10_00).to_s.should == "10.00"
|
|
464
470
|
end
|
|
465
471
|
|
|
472
|
+
specify "Money.to_s works with :subunit_to_unit other than 100" do
|
|
473
|
+
Money.new(10_00, "BHD").to_s.should == "1.00"
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
specify "Money.to_s shouldn't have decimal when :subunit_to_unit is 1" do
|
|
477
|
+
Money.new(10_00, "CLP").to_s.should == "1000"
|
|
478
|
+
end
|
|
479
|
+
|
|
466
480
|
specify "Money.to_f works" do
|
|
467
481
|
Money.new(10_00).to_f.should == 10.0
|
|
468
482
|
end
|
|
469
483
|
|
|
484
|
+
specify "Money.to_f works with :subunit_to_unit other than 100" do
|
|
485
|
+
Money.new(10_00, "BHD").to_f.should == 1.0
|
|
486
|
+
end
|
|
487
|
+
|
|
470
488
|
describe "#format" do
|
|
471
489
|
it "returns the monetary value as a string" do
|
|
472
490
|
Money.ca_dollar(100).format.should == "$1.00"
|
|
473
491
|
end
|
|
474
492
|
|
|
493
|
+
it "uses the correct :subunit_to_unit" do
|
|
494
|
+
Money.new(10_00, "BHD").format.should == "ب.د1.00"
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
it "doesn't display a decimal when :subunit_to_unit is 1" do
|
|
498
|
+
Money.new(10_00, "CLP").format.should == "$1.000"
|
|
499
|
+
end
|
|
500
|
+
|
|
475
501
|
specify "respects the delimiter and separator defaults" do
|
|
476
502
|
one_thousand = Proc.new do |currency|
|
|
477
503
|
Money.new(1000_00, currency).format
|
|
@@ -489,7 +515,7 @@ describe Money do
|
|
|
489
515
|
|
|
490
516
|
# Yen
|
|
491
517
|
one_thousand["JPY"].should == "¥1,000.00"
|
|
492
|
-
one_thousand["CNY"].should == "¥
|
|
518
|
+
one_thousand["CNY"].should == "¥10,000.00"
|
|
493
519
|
|
|
494
520
|
# Euro
|
|
495
521
|
one_thousand["EUR"].should == "€1,000.00"
|
|
@@ -536,39 +562,19 @@ describe Money do
|
|
|
536
562
|
|
|
537
563
|
currency = Money::Currency.new("EUR")
|
|
538
564
|
currency.should_receive(:symbol).and_return(nil)
|
|
539
|
-
Money.empty(currency).symbol.should == "
|
|
565
|
+
Money.empty(currency).symbol.should == "¤"
|
|
540
566
|
end
|
|
541
567
|
|
|
542
568
|
specify "#delimiter works as documented" do
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
Money::DELIMITERS["EUR"] = "."
|
|
547
|
-
|
|
548
|
-
Money.empty("EUR").delimiter.should == "."
|
|
549
|
-
Money.empty("USD").delimiter.should == ","
|
|
550
|
-
Money.empty("GBP").delimiter.should == ","
|
|
551
|
-
ensure
|
|
552
|
-
silence_warnings do
|
|
553
|
-
Money::DELIMITERS = old
|
|
554
|
-
end
|
|
555
|
-
end
|
|
569
|
+
Money.empty("USD").delimiter.should == ","
|
|
570
|
+
Money.empty("EUR").delimiter.should == ","
|
|
571
|
+
Money.empty("BRL").delimiter.should == "."
|
|
556
572
|
end
|
|
557
573
|
|
|
558
574
|
specify "#separator works as documented" do
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
Money::SEPARATORS["EUR"] = "_"
|
|
563
|
-
|
|
564
|
-
Money.empty("EUR").separator.should == "_"
|
|
565
|
-
Money.empty("USD").separator.should == "."
|
|
566
|
-
Money.empty("GBP").separator.should == "."
|
|
567
|
-
ensure
|
|
568
|
-
silence_warnings do
|
|
569
|
-
Money::SEPARATORS = old
|
|
570
|
-
end
|
|
571
|
-
end
|
|
575
|
+
Money.empty("USD").separator.should == "."
|
|
576
|
+
Money.empty("EUR").separator.should == "."
|
|
577
|
+
Money.empty("BRL").separator.should == ","
|
|
572
578
|
end
|
|
573
579
|
|
|
574
580
|
specify "#format(:with_currency => true) works as documented" do
|
|
@@ -589,6 +595,10 @@ describe Money do
|
|
|
589
595
|
Money.ca_dollar(39000).format(:no_cents => true).should == "$390"
|
|
590
596
|
end
|
|
591
597
|
|
|
598
|
+
specify "#format(:no_cents => true) uses correct :subunit_to_unit" do
|
|
599
|
+
Money.new(10_00, "BHD").format(:no_cents => true).should == "ب.د1"
|
|
600
|
+
end
|
|
601
|
+
|
|
592
602
|
specify "#format(:no_cents) works as documented" do
|
|
593
603
|
Money.ca_dollar(100).format(:no_cents).should == "$1"
|
|
594
604
|
Money.ca_dollar(599).format(:no_cents).should == "$5"
|
|
@@ -596,6 +606,10 @@ describe Money do
|
|
|
596
606
|
Money.ca_dollar(39000).format(:no_cents).should == "$390"
|
|
597
607
|
end
|
|
598
608
|
|
|
609
|
+
specify "#format(:no_cents) uses correct :subunit_to_unit" do
|
|
610
|
+
Money.new(10_00, "BHD").format(:no_cents).should == "ب.د1"
|
|
611
|
+
end
|
|
612
|
+
|
|
599
613
|
specify "#format(:symbol => a symbol string) uses the given value as the money symbol" do
|
|
600
614
|
Money.new(100, "GBP").format(:symbol => "£").should == "£1.00"
|
|
601
615
|
end
|
|
@@ -617,7 +631,7 @@ describe Money do
|
|
|
617
631
|
|
|
618
632
|
# Yen
|
|
619
633
|
one["JPY"].should == "¥1.00"
|
|
620
|
-
one["CNY"].should == "¥
|
|
634
|
+
one["CNY"].should == "¥10.00"
|
|
621
635
|
|
|
622
636
|
# Euro
|
|
623
637
|
one["EUR"].should == "€1.00"
|
|
@@ -639,7 +653,7 @@ describe Money do
|
|
|
639
653
|
specify "#format(:symbol => true) returns $ when currency code is not recognized" do
|
|
640
654
|
currency = Money::Currency.new("EUR")
|
|
641
655
|
currency.should_receive(:symbol).and_return(nil)
|
|
642
|
-
Money.new(100, currency).format(:symbol => true).should == "
|
|
656
|
+
Money.new(100, currency).format(:symbol => true).should == "¤1.00"
|
|
643
657
|
end
|
|
644
658
|
|
|
645
659
|
specify "#format(:symbol => some non-Boolean value that evaluates to true) returs symbol based on the given currency code" do
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: money
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 13
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 3
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 3.0.
|
|
9
|
+
- 5
|
|
10
|
+
version: 3.0.5
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Tobias Luetke
|
|
@@ -18,7 +18,7 @@ autorequire:
|
|
|
18
18
|
bindir: bin
|
|
19
19
|
cert_chain: []
|
|
20
20
|
|
|
21
|
-
date: 2010-
|
|
21
|
+
date: 2010-07-16 00:00:00 -04:00
|
|
22
22
|
default_executable:
|
|
23
23
|
dependencies:
|
|
24
24
|
- !ruby/object:Gem::Dependency
|