money 3.6.1 → 3.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,63 +1,82 @@
1
- # Open +Numeric+ to add new method.
2
- class Numeric
3
-
4
- # Converts this numeric into a +Money+ object in the given +currency+.
5
- #
6
- # @param [Currency, String, Symbol] currency
7
- # The currency to set the resulting +Money+ object to.
8
- #
9
- # @return [Money]
10
- #
11
- # @example
12
- # 100.to_money #=> #<Money @cents=10000>
13
- # 100.37.to_money #=> #<Money @cents=10037>
14
- # BigDecimal.new('100').to_money #=> #<Money @cents=10000>
15
- #
16
- # @see Money.from_numeric
17
- #
18
- def to_money(currency = nil)
19
- Money.from_numeric(self, currency || Money.default_currency)
20
- end
21
-
22
- end
23
-
24
- # Open +String+ to add new methods.
25
- class String
26
-
27
- # Parses the current string and converts it to a +Money+ object.
28
- # Excess characters will be discarded.
29
- #
30
- # @param [Currency, String, Symbol] currency
31
- # The currency to set the resulting +Money+ object to.
32
- #
33
- # @return [Money]
34
- #
35
- # @example
36
- # '100'.to_money #=> #<Money @cents=10000>
37
- # '100.37'.to_money #=> #<Money @cents=10037>
38
- # '100 USD'.to_money #=> #<Money @cents=10000, @currency=#<Money::Currency id: usd>>
39
- # 'USD 100'.to_money #=> #<Money @cents=10000, @currency=#<Money::Currency id: usd>>
40
- # '$100 USD'.to_money #=> #<Money @cents=10000, @currency=#<Money::Currency id: usd>>
41
- # 'hello 2000 world'.to_money #=> #<Money @cents=200000 @currency=#<Money::Currency id: usd>>
42
- #
43
- # @see Money.from_string
44
- #
45
- def to_money(currency = nil)
46
- Money.parse(self, currency)
47
- end
48
-
49
- # Converts the current string into a +Currency+ object.
50
- #
51
- # @return [Money::Currency]
52
- #
53
- # @raise [Money::Currency::UnknownCurrency]
54
- # If this String reference an unknown currency.
55
- #
56
- # @example
57
- # "USD".to_currency #=> #<Money::Currency id: usd>
58
- #
59
- def to_currency
60
- Money::Currency.new(self)
61
- end
62
-
63
- end
1
+ # Open +Numeric+ to add new method.
2
+ class Numeric
3
+
4
+ # Converts this numeric into a +Money+ object in the given +currency+.
5
+ #
6
+ # @param [Currency, String, Symbol] currency
7
+ # The currency to set the resulting +Money+ object to.
8
+ #
9
+ # @return [Money]
10
+ #
11
+ # @example
12
+ # 100.to_money #=> #<Money @cents=10000>
13
+ # 100.37.to_money #=> #<Money @cents=10037>
14
+ # BigDecimal.new('100').to_money #=> #<Money @cents=10000>
15
+ #
16
+ # @see Money.from_numeric
17
+ #
18
+ def to_money(currency = nil)
19
+ Money.from_numeric(self, currency || Money.default_currency)
20
+ end
21
+
22
+ end
23
+
24
+ # Open +String+ to add new methods.
25
+ class String
26
+
27
+ # Parses the current string and converts it to a +Money+ object.
28
+ # Excess characters will be discarded.
29
+ #
30
+ # @param [Currency, String, Symbol] currency
31
+ # The currency to set the resulting +Money+ object to.
32
+ #
33
+ # @return [Money]
34
+ #
35
+ # @example
36
+ # '100'.to_money #=> #<Money @cents=10000>
37
+ # '100.37'.to_money #=> #<Money @cents=10037>
38
+ # '100 USD'.to_money #=> #<Money @cents=10000, @currency=#<Money::Currency id: usd>>
39
+ # 'USD 100'.to_money #=> #<Money @cents=10000, @currency=#<Money::Currency id: usd>>
40
+ # '$100 USD'.to_money #=> #<Money @cents=10000, @currency=#<Money::Currency id: usd>>
41
+ # 'hello 2000 world'.to_money #=> #<Money @cents=200000 @currency=#<Money::Currency id: usd>>
42
+ #
43
+ # @see Money.from_string
44
+ #
45
+ def to_money(currency = nil)
46
+ Money.parse(self, currency)
47
+ end
48
+
49
+ # Converts the current string into a +Currency+ object.
50
+ #
51
+ # @return [Money::Currency]
52
+ #
53
+ # @raise [Money::Currency::UnknownCurrency]
54
+ # If this String reference an unknown currency.
55
+ #
56
+ # @example
57
+ # "USD".to_currency #=> #<Money::Currency id: usd>
58
+ #
59
+ def to_currency
60
+ Money::Currency.new(self)
61
+ end
62
+
63
+ end
64
+
65
+ # Open +Symbol+ to add new methods.
66
+ class Symbol
67
+
68
+ # Converts the current symbol into a +Currency+ object.
69
+ #
70
+ # @return [Money::Currency]
71
+ #
72
+ # @raise [Money::Currency::UnknownCurrency]
73
+ # If this String reference an unknown currency.
74
+ #
75
+ # @example
76
+ # :ars.to_currency #=> #<Money::Currency id: ars>
77
+ #
78
+ def to_currency
79
+ Money::Currency.new(self)
80
+ end
81
+
82
+ end
@@ -1,415 +1,422 @@
1
- # encoding: utf-8
2
-
3
- class Money
4
-
5
- # Represents a specific currency unit.
6
- class Currency
7
- include Comparable
8
-
9
- # Thrown when an unknown currency is requested.
10
- class UnknownCurrency < StandardError; end
11
-
12
- # List of known currencies.
13
- #
14
- # == monetary unit
15
- # The standard unit of value of a currency, as the dollar in the United States or the peso in Mexico.
16
- # http://www.answers.com/topic/monetary-unit
17
- # == fractional monetary unit, subunit
18
- # A monetary unit that is valued at a fraction (usually one hundredth) of the basic monetary unit
19
- # http://www.answers.com/topic/fractional-monetary-unit-subunit
20
- #
21
- # See http://en.wikipedia.org/wiki/List_of_circulating_currencies and
22
- # http://search.cpan.org/~tnguyen/Locale-Currency-Format-1.28/Format.pm
23
-
24
- TABLE = {
25
- :aed => { :priority => 100, :iso_code => "AED", :name => "United Arab Emirates Dirham", :symbol => "د.إ", :subunit => "Fils", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
26
- :afn => { :priority => 100, :iso_code => "AFN", :name => "Afghan Afghani", :symbol => "؋", :subunit => "Pul", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
27
- :all => { :priority => 100, :iso_code => "ALL", :name => "Albanian Lek", :symbol => "L", :subunit => "Qintar", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
28
- :amd => { :priority => 100, :iso_code => "AMD", :name => "Armenian Dram", :symbol => "դր.", :subunit => "Luma", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
29
- :ang => { :priority => 100, :iso_code => "ANG", :name => "Netherlands Antillean Gulden", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x0192;", :decimal_mark => ",", :thousands_separator => "."},
30
- :aoa => { :priority => 100, :iso_code => "AOA", :name => "Angolan Kwanza", :symbol => "Kz", :subunit => "Cêntimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
31
- :ars => { :priority => 100, :iso_code => "ARS", :name => "Argentine Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ",", :thousands_separator => "."},
32
- :aud => { :priority => 4, :iso_code => "AUD", :name => "Australian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
33
- :awg => { :priority => 100, :iso_code => "AWG", :name => "Aruban Florin", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x0192;", :decimal_mark => ".", :thousands_separator => ","},
34
- :azn => { :priority => 100, :iso_code => "AZN", :name => "Azerbaijani Manat", :symbol => nil, :subunit => "Qəpik", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
35
- :bam => { :priority => 100, :iso_code => "BAM", :name => "Bosnia and Herzegovina Convertible Mark", :symbol => "KM or КМ", :subunit => "Fening", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
36
- :bbd => { :priority => 100, :iso_code => "BBD", :name => "Barbadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
37
- :bdt => { :priority => 100, :iso_code => "BDT", :name => "Bangladeshi Taka", :symbol => "৳", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
38
- :bgn => { :priority => 100, :iso_code => "BGN", :name => "Bulgarian Lev", :symbol => "лв", :subunit => "Stotinka", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
39
- :bhd => { :priority => 100, :iso_code => "BHD", :name => "Bahraini Dinar", :symbol => "ب.د", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
40
- :bif => { :priority => 100, :iso_code => "BIF", :name => "Burundian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
41
- :bmd => { :priority => 100, :iso_code => "BMD", :name => "Bermudian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
42
- :bnd => { :priority => 100, :iso_code => "BND", :name => "Brunei Dollar", :symbol => "$", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
43
- :bob => { :priority => 100, :iso_code => "BOB", :name => "Bolivian Boliviano", :symbol => "Bs.", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
44
- :brl => { :priority => 100, :iso_code => "BRL", :name => "Brazilian Real", :symbol => "R$ ", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "R\$", :decimal_mark => ",", :thousands_separator => "."},
45
- :bsd => { :priority => 100, :iso_code => "BSD", :name => "Bahamian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
46
- :btn => { :priority => 100, :iso_code => "BTN", :name => "Bhutanese Ngultrum", :symbol => nil, :subunit => "Chertrum", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
47
- :bwp => { :priority => 100, :iso_code => "BWP", :name => "Botswana Pula", :symbol => "P", :subunit => "Thebe", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
48
- :byr => { :priority => 100, :iso_code => "BYR", :name => "Belarusian Ruble", :symbol => "Br", :subunit => "Kapyeyka", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
49
- :bzd => { :priority => 100, :iso_code => "BZD", :name => "Belize Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
50
- :cad => { :priority => 5, :iso_code => "CAD", :name => "Canadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
51
- :cdf => { :priority => 100, :iso_code => "CDF", :name => "Congolese Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
52
- :chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
53
- :clp => { :priority => 100, :iso_code => "CLP", :name => "Chilean Peso", :symbol => "$", :subunit => "Peso", :subunit_to_unit => 1, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ",", :thousands_separator => "."},
54
- :cny => { :priority => 100, :iso_code => "CNY", :name => "Chinese Renminbi Yuan", :symbol => "¥", :subunit => "Fen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x5713;", :decimal_mark => ".", :thousands_separator => ","},
55
- :cop => { :priority => 100, :iso_code => "COP", :name => "Colombian Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ",", :thousands_separator => "."},
56
- :crc => { :priority => 100, :iso_code => "CRC", :name => "Costa Rican Colón", :symbol => "₡", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A1;", :decimal_mark => ",", :thousands_separator => "."},
57
- :cuc => { :priority => 100, :iso_code => "CUC", :name => "Cuban Convertible Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
58
- :cup => { :priority => 100, :iso_code => "CUP", :name => "Cuban Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ".", :thousands_separator => ","},
59
- :cve => { :priority => 100, :iso_code => "CVE", :name => "Cape Verdean Escudo", :symbol => "$ or Esc", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
60
- :czk => { :priority => 100, :iso_code => "CZK", :name => "Czech Koruna", :symbol => "Kč", :subunit => "Haléř", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
61
- :djf => { :priority => 100, :iso_code => "DJF", :name => "Djiboutian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
62
- :dkk => { :priority => 100, :iso_code => "DKK", :name => "Danish Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
63
- :dop => { :priority => 100, :iso_code => "DOP", :name => "Dominican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ".", :thousands_separator => ","},
64
- :dzd => { :priority => 100, :iso_code => "DZD", :name => "Algerian Dinar", :symbol => "د.ج", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
65
- :eek => { :priority => 100, :iso_code => "EEK", :name => "Estonian Kroon", :symbol => "KR", :subunit => "Sent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
66
- :egp => { :priority => 100, :iso_code => "EGP", :name => "Egyptian Pound", :symbol => "£ or ج.م", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
67
- :ern => { :priority => 100, :iso_code => "ERN", :name => "Eritrean Nakfa", :symbol => "Nfk", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
68
- :etb => { :priority => 100, :iso_code => "ETB", :name => "Ethiopian Birr", :symbol => nil, :subunit => "Santim", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
69
- :eur => { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20AC;", :decimal_mark => ",", :thousands_separator => "."},
70
- :fjd => { :priority => 100, :iso_code => "FJD", :name => "Fijian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
71
- :fkp => { :priority => 100, :iso_code => "FKP", :name => "Falkland Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
72
- :gbp => { :priority => 3, :iso_code => "GBP", :name => "British Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
73
- :gel => { :priority => 100, :iso_code => "GEL", :name => "Georgian Lari", :symbol => "ლ", :subunit => "Tetri", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
74
- :ghs => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B5;", :decimal_mark => ".", :thousands_separator => ","},
75
- :gip => { :priority => 100, :iso_code => "GIP", :name => "Gibraltar Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
76
- :gmd => { :priority => 100, :iso_code => "GMD", :name => "Gambian Dalasi", :symbol => "D", :subunit => "Butut", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
77
- :gnf => { :priority => 100, :iso_code => "GNF", :name => "Guinean Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
78
- :gtq => { :priority => 100, :iso_code => "GTQ", :name => "Guatemalan Quetzal", :symbol => "Q", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
79
- :gyd => { :priority => 100, :iso_code => "GYD", :name => "Guyanese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
80
- :hkd => { :priority => 100, :iso_code => "HKD", :name => "Hong Kong Dollar", :symbol => "$", :subunit => "Ho", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
81
- :hnl => { :priority => 100, :iso_code => "HNL", :name => "Honduran Lempira", :symbol => "L", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
82
- :hrk => { :priority => 100, :iso_code => "HRK", :name => "Croatian Kuna", :symbol => "kn", :subunit => "Lipa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
83
- :htg => { :priority => 100, :iso_code => "HTG", :name => "Haitian Gourde", :symbol => "G", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
84
- :huf => { :priority => 100, :iso_code => "HUF", :name => "Hungarian Forint", :symbol => "Ft", :subunit => "Fillér", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
85
- :idr => { :priority => 100, :iso_code => "IDR", :name => "Indonesian Rupiah", :symbol => "Rp", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
86
- :ils => { :priority => 100, :iso_code => "ILS", :name => "Israeli New Sheqel", :symbol => "₪", :subunit => "Agora", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20AA;", :decimal_mark => ".", :thousands_separator => ","},
87
- :inr => { :priority => 100, :iso_code => "INR", :name => "Indian Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
88
- :iqd => { :priority => 100, :iso_code => "IQD", :name => "Iraqi Dinar", :symbol => "ع.د", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
89
- :irr => { :priority => 100, :iso_code => "IRR", :name => "Iranian Rial", :symbol => "﷼", :subunit => "Dinar", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
90
- :isk => { :priority => 100, :iso_code => "ISK", :name => "Icelandic Króna", :symbol => "kr", :subunit => "Eyrir", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
91
- :jmd => { :priority => 100, :iso_code => "JMD", :name => "Jamaican Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
92
- :jod => { :priority => 100, :iso_code => "JOD", :name => "Jordanian Dinar", :symbol => "د.ا", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
93
- :jpy => { :priority => 6, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A5;", :decimal_mark => ".", :thousands_separator => ","},
94
- :kes => { :priority => 100, :iso_code => "KES", :name => "Kenyan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
95
- :kgs => { :priority => 100, :iso_code => "KGS", :name => "Kyrgyzstani Som", :symbol => nil, :subunit => "Tyiyn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
96
- :khr => { :priority => 100, :iso_code => "KHR", :name => "Cambodian Riel", :symbol => "៛", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x17DB;", :decimal_mark => ".", :thousands_separator => ","},
97
- :kmf => { :priority => 100, :iso_code => "KMF", :name => "Comorian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
98
- :kpw => { :priority => 100, :iso_code => "KPW", :name => "North Korean Won", :symbol => "₩", :subunit => "Chŏn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20A9;", :decimal_mark => ".", :thousands_separator => ","},
99
- :krw => { :priority => 100, :iso_code => "KRW", :name => "South Korean Won", :symbol => "₩", :subunit => "Jeon", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A9;", :decimal_mark => ".", :thousands_separator => ","},
100
- :kwd => { :priority => 100, :iso_code => "KWD", :name => "Kuwaiti Dinar", :symbol => "د.ك", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
101
- :kyd => { :priority => 100, :iso_code => "KYD", :name => "Cayman Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
102
- :kzt => { :priority => 100, :iso_code => "KZT", :name => "Kazakhstani Tenge", :symbol => "〒", :subunit => "Tiyn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
103
- :lak => { :priority => 100, :iso_code => "LAK", :name => "Lao Kip", :symbol => "₭", :subunit => "Att", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20AD;", :decimal_mark => ".", :thousands_separator => ","},
104
- :lbp => { :priority => 100, :iso_code => "LBP", :name => "Lebanese Lira", :symbol => "ل.ل", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
105
- :lkr => { :priority => 100, :iso_code => "LKR", :name => "Sri Lankan Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x0BF9;", :decimal_mark => ".", :thousands_separator => ","},
106
- :lrd => { :priority => 100, :iso_code => "LRD", :name => "Liberian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
107
- :lsl => { :priority => 100, :iso_code => "LSL", :name => "Lesotho Loti", :symbol => "L", :subunit => "Sente", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
108
- :ltl => { :priority => 100, :iso_code => "LTL", :name => "Lithuanian Litas", :symbol => "Lt", :subunit => "Centas", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
109
- :lvl => { :priority => 100, :iso_code => "LVL", :name => "Latvian Lats", :symbol => "Ls", :subunit => "Santīms", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
110
- :lyd => { :priority => 100, :iso_code => "LYD", :name => "Libyan Dinar", :symbol => "ل.د", :subunit => "Dirham", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
111
- :mad => { :priority => 100, :iso_code => "MAD", :name => "Moroccan Dirham", :symbol => "د.م.", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
112
- :mdl => { :priority => 100, :iso_code => "MDL", :name => "Moldovan Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
113
- :mga => { :priority => 100, :iso_code => "MGA", :name => "Malagasy Ariary", :symbol => nil, :subunit => "Iraimbilanja", :subunit_to_unit => 5, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
114
- :mkd => { :priority => 100, :iso_code => "MKD", :name => "Macedonian Denar", :symbol => "ден", :subunit => "Deni", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
115
- :mmk => { :priority => 100, :iso_code => "MMK", :name => "Myanmar Kyat", :symbol => "K", :subunit => "Pya", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
116
- :mnt => { :priority => 100, :iso_code => "MNT", :name => "Mongolian Tögrög", :symbol => "₮", :subunit => "Möngö", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20AE;", :decimal_mark => ".", :thousands_separator => ","},
117
- :mop => { :priority => 100, :iso_code => "MOP", :name => "Macanese Pataca", :symbol => "P", :subunit => "Avo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
118
- :mro => { :priority => 100, :iso_code => "MRO", :name => "Mauritanian Ouguiya", :symbol => "UM", :subunit => "Khoums", :subunit_to_unit => 5, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
119
- :mur => { :priority => 100, :iso_code => "MUR", :name => "Mauritian Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
120
- :mvr => { :priority => 100, :iso_code => "MVR", :name => "Maldivian Rufiyaa", :symbol => "ރ.", :subunit => "Laari", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
121
- :mwk => { :priority => 100, :iso_code => "MWK", :name => "Malawian Kwacha", :symbol => "MK", :subunit => "Tambala", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
122
- :mxn => { :priority => 100, :iso_code => "MXN", :name => "Mexican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
123
- :myr => { :priority => 100, :iso_code => "MYR", :name => "Malaysian Ringgit", :symbol => "RM", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
124
- :mzn => { :priority => 100, :iso_code => "MZN", :name => "Mozambican Metical", :symbol => "MTn", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
125
- :nad => { :priority => 100, :iso_code => "NAD", :name => "Namibian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
126
- :ngn => { :priority => 100, :iso_code => "NGN", :name => "Nigerian Naira", :symbol => "₦", :subunit => "Kobo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20A6;", :decimal_mark => ".", :thousands_separator => ","},
127
- :nio => { :priority => 100, :iso_code => "NIO", :name => "Nicaraguan Córdoba", :symbol => "C$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
128
- :nok => { :priority => 100, :iso_code => "NOK", :name => "Norwegian Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "kr", :decimal_mark => ",", :thousands_separator => "."},
129
- :npr => { :priority => 100, :iso_code => "NPR", :name => "Nepalese Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
130
- :nzd => { :priority => 100, :iso_code => "NZD", :name => "New Zealand Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
131
- :omr => { :priority => 100, :iso_code => "OMR", :name => "Omani Rial", :symbol => "ر.ع.", :subunit => "Baisa", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
132
- :pab => { :priority => 100, :iso_code => "PAB", :name => "Panamanian Balboa", :symbol => "B/.", :subunit => "Centésimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
133
- :pen => { :priority => 100, :iso_code => "PEN", :name => "Peruvian Nuevo Sol", :symbol => "S/.", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "S/.", :decimal_mark => ".", :thousands_separator => ","},
134
- :pgk => { :priority => 100, :iso_code => "PGK", :name => "Papua New Guinean Kina", :symbol => "K", :subunit => "Toea", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
135
- :php => { :priority => 100, :iso_code => "PHP", :name => "Philippine Peso", :symbol => "₱", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20B1;", :decimal_mark => ".", :thousands_separator => ","},
136
- :pkr => { :priority => 100, :iso_code => "PKR", :name => "Pakistani Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
137
- :pln => { :priority => 100, :iso_code => "PLN", :name => "Polish Złoty", :symbol => "zł", :subunit => "Grosz", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
138
- :pyg => { :priority => 100, :iso_code => "PYG", :name => "Paraguayan Guaraní", :symbol => "₲", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B2;", :decimal_mark => ".", :thousands_separator => ","},
139
- :qar => { :priority => 100, :iso_code => "QAR", :name => "Qatari Riyal", :symbol => "ر.ق", :subunit => "Dirham", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
140
- :ron => { :priority => 100, :iso_code => "RON", :name => "Romanian Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
141
- :rsd => { :priority => 100, :iso_code => "RSD", :name => "Serbian Dinar", :symbol => "din. or дин.", :subunit => "Para", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
142
- :rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "р.", :subunit => "Kopek", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x0440;&#x0443;&#x0431;", :decimal_mark => ",", :thousands_separator => "."},
143
- :rwf => { :priority => 100, :iso_code => "RWF", :name => "Rwandan Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
144
- :sar => { :priority => 100, :iso_code => "SAR", :name => "Saudi Riyal", :symbol => "ر.س", :subunit => "Hallallah", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
145
- :sbd => { :priority => 100, :iso_code => "SBD", :name => "Solomon Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
146
- :scr => { :priority => 100, :iso_code => "SCR", :name => "Seychellois Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
147
- :sdg => { :priority => 100, :iso_code => "SDG", :name => "Sudanese Pound", :symbol => "£", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
148
- :sek => { :priority => 100, :iso_code => "SEK", :name => "Swedish Krona", :symbol => "kr", :subunit => "Öre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
149
- :sgd => { :priority => 100, :iso_code => "SGD", :name => "Singapore Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
150
- :shp => { :priority => 100, :iso_code => "SHP", :name => "Saint Helenian Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
151
- :skk => { :priority => 100, :iso_code => "SKK", :name => "Slovak Koruna", :symbol => "Sk", :subunit => "Halier", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
152
- :sll => { :priority => 100, :iso_code => "SLL", :name => "Sierra Leonean Leone", :symbol => "Le", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
153
- :sos => { :priority => 100, :iso_code => "SOS", :name => "Somali Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
154
- :srd => { :priority => 100, :iso_code => "SRD", :name => "Surinamese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
155
- :std => { :priority => 100, :iso_code => "STD", :name => "São Tomé and Príncipe Dobra", :symbol => "Db", :subunit => "Cêntimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
156
- :svc => { :priority => 100, :iso_code => "SVC", :name => "Salvadoran Colón", :symbol => "₡", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A1;", :decimal_mark => ".", :thousands_separator => ","},
157
- :syp => { :priority => 100, :iso_code => "SYP", :name => "Syrian Pound", :symbol => "£ or ل.س", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
158
- :szl => { :priority => 100, :iso_code => "SZL", :name => "Swazi Lilangeni", :symbol => "L", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
159
- :thb => { :priority => 100, :iso_code => "THB", :name => "Thai Baht", :symbol => "฿", :subunit => "Satang", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x0E3F;", :decimal_mark => ".", :thousands_separator => ","},
160
- :tjs => { :priority => 100, :iso_code => "TJS", :name => "Tajikistani Somoni", :symbol => "ЅМ", :subunit => "Diram", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
161
- :tmm => { :priority => 100, :iso_code => "TMM", :name => "Turkmenistani Manat", :symbol => "m", :subunit => "Tennesi", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
162
- :tnd => { :priority => 100, :iso_code => "TND", :name => "Tunisian Dinar", :symbol => "د.ت", :subunit => "Millime", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
163
- :top => { :priority => 100, :iso_code => "TOP", :name => "Tongan Paʻanga", :symbol => "T$", :subunit => "Seniti", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
164
- :try => { :priority => 100, :iso_code => "TRY", :name => "Turkish New Lira", :symbol => "YTL", :subunit => "New kuruş", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
165
- :ttd => { :priority => 100, :iso_code => "TTD", :name => "Trinidad and Tobago Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
166
- :twd => { :priority => 100, :iso_code => "TWD", :name => "New Taiwan Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
167
- :tzs => { :priority => 100, :iso_code => "TZS", :name => "Tanzanian Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
168
- :uah => { :priority => 100, :iso_code => "UAH", :name => "Ukrainian Hryvnia", :symbol => "₴", :subunit => "Kopiyka", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20B4", :decimal_mark => ".", :thousands_separator => ","},
169
- :ugx => { :priority => 100, :iso_code => "UGX", :name => "Ugandan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
170
- :usd => { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
171
- :uyu => { :priority => 100, :iso_code => "UYU", :name => "Uruguayan Peso", :symbol => "$", :subunit => "Centésimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ",", :thousands_separator => "."},
172
- :uzs => { :priority => 100, :iso_code => "UZS", :name => "Uzbekistani Som", :symbol => nil, :subunit => "Tiyin", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
173
- :vef => { :priority => 100, :iso_code => "VEF", :name => "Venezuelan Bolívar", :symbol => "Bs F", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
174
- :vnd => { :priority => 100, :iso_code => "VND", :name => "Vietnamese Đồng", :symbol => "₫", :subunit => "Hào", :subunit_to_unit => 10, :symbol_first => true, :html_entity => "&#x20AB;", :decimal_mark => ",", :thousands_separator => "."},
175
- :vuv => { :priority => 100, :iso_code => "VUV", :name => "Vanuatu Vatu", :symbol => "Vt", :subunit => nil, :subunit_to_unit => 1, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
176
- :wst => { :priority => 100, :iso_code => "WST", :name => "Samoan Tala", :symbol => "T", :subunit => "Sene", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
177
- :xaf => { :priority => 100, :iso_code => "XAF", :name => "Central African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
178
- :xcd => { :priority => 100, :iso_code => "XCD", :name => "East Caribbean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
179
- :xof => { :priority => 100, :iso_code => "XOF", :name => "West African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
180
- :xpf => { :priority => 100, :iso_code => "XPF", :name => "Cfp Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
181
- :yer => { :priority => 100, :iso_code => "YER", :name => "Yemeni Rial", :symbol => "﷼", :subunit => "Fils", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
182
- :zar => { :priority => 100, :iso_code => "ZAR", :name => "South African Rand", :symbol => "R", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x0052;", :decimal_mark => ".", :thousands_separator => ","},
183
- :zmk => { :priority => 100, :iso_code => "ZMK", :name => "Zambian Kwacha", :symbol => "ZK", :subunit => "Ngwee", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
184
- :zwd => { :priority => 100, :iso_code => "ZWD", :name => "Zimbabwean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
185
-
186
- # aliases for BC with documentation before Currency
187
- :yen => { :priority => 100, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A5;", :decimal_mark => ".", :thousands_separator => ","},
188
-
189
- # kept for backwards compatibility, real entry is :ghs
190
- :ghc => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B5;", :decimal_mark => ".", :thousands_separator => "," }
191
- }
192
-
193
-
194
- # The symbol used to identify the currency, usually the lowercase
195
- # +iso_code+ attribute.
196
- #
197
- # @return [Symbol]
198
- attr_reader :id
199
-
200
- # A numerical value you can use to sort/group the currency list.
201
- #
202
- # @return [Integer]
203
- attr_reader :priority
204
-
205
- # The international 3-letter code as defined by the ISO 4217 standard.
206
- #
207
- # @return [String]
208
- attr_reader :iso_code
209
-
210
- # The currency name.
211
- #
212
- # @return [String]
213
- attr_reader :name
214
-
215
- # The currency symbol (UTF-8 encoded).
216
- #
217
- # @return [String]
218
- attr_reader :symbol
219
-
220
- # The html entity for the currency symbol
221
- #
222
- # @return [String]
223
- attr_reader :html_entity
224
-
225
- # The name of the fractional monetary unit.
226
- #
227
- # @return [String]
228
- attr_reader :subunit
229
-
230
- # The proportion between the unit and the subunit
231
- #
232
- # @return [Integer]
233
- attr_reader :subunit_to_unit
234
-
235
- # The decimal mark, or character used to separate the whole unit from the subunit.
236
- #
237
- # @return [String]
238
- attr_reader :decimal_mark
239
- alias :separator :decimal_mark
240
-
241
- # The character used to separate thousands grouping of the whole unit.
242
- #
243
- # @return [String]
244
- attr_reader :thousands_separator
245
- alias :delimiter :thousands_separator
246
-
247
- # Should the currency symbol precede the amount, or should it come after?
248
- #
249
- # @return [boolean]
250
- attr_reader :symbol_first
251
-
252
- def symbol_first?
253
- !!@symbol_first
254
- end
255
-
256
- # The number of decimal places needed.
257
- #
258
- # @return [Integer]
259
- def decimal_places
260
- if subunit_to_unit == 1
261
- 0
262
- elsif subunit_to_unit % 10 == 0
263
- Math.log10(subunit_to_unit).to_s.to_i
264
- else
265
- Math.log10(subunit_to_unit).to_s.to_i+1
266
- end
267
- end
268
-
269
- # Create a new +Currency+ object.
270
- #
271
- # @param [String, Symbol, #to_s] id Used to look into +TABLE+ and retrieve
272
- # the applicable attributes.
273
- #
274
- # @return [Money::Currency]
275
- #
276
- # @example
277
- # Money::Currency.new(:usd) #=> #<Money::Currency id: usd ...>
278
- def initialize(id)
279
- @id = id.to_s.downcase.to_sym
280
- data = TABLE[@id] || raise(UnknownCurrency, "Unknown currency `#{id}'")
281
- data.each_pair do |key, value|
282
- instance_variable_set(:"@#{key}", value)
283
- end
284
- end
285
-
286
- # Compares +self+ with +other_currency+ against the value of +priority+
287
- # attribute.
288
- #
289
- # @param [Money::Currency] other_currency The currency to compare to.
290
- #
291
- # @return [-1,0,1] -1 if less than, 0 is equal to, 1 if greater than
292
- #
293
- # @example
294
- # c1 = Money::Currency.new(:usd)
295
- # c2 = Money::Currency.new(:jpy)
296
- # c1 <=> c2 #=> 1
297
- # c2 <=> c1 #=> -1
298
- # c1 <=> c1 #=> 0
299
- def <=>(other_currency)
300
- self.priority <=> other_currency.priority
301
- end
302
-
303
- # Compares +self+ with +other_currency+ and returns +true+ if the are the
304
- # same or if their +id+ attributes match.
305
- #
306
- # @param [Money::Currency] other_currency The currency to compare to.
307
- #
308
- # @return [Boolean]
309
- #
310
- # @example
311
- # c1 = Money::Currency.new(:usd)
312
- # c2 = Money::Currency.new(:jpy)
313
- # c1 == c1 #=> true
314
- # c1 == c2 #=> false
315
- def ==(other_currency)
316
- self.equal?(other_currency) ||
317
- self.id == other_currency.id
318
- end
319
-
320
- # Compares +self+ with +other_currency+ and returns +true+ if the are the
321
- # same or if their +id+ attributes match.
322
- #
323
- # @param [Money::Currency] other_currency The currency to compare to.
324
- #
325
- # @return [Boolean]
326
- #
327
- # @example
328
- # c1 = Money::Currency.new(:usd)
329
- # c2 = Money::Currency.new(:jpy)
330
- # c1.eql? c1 #=> true
331
- # c1.eql? c2 #=> false
332
- def eql?(other_currency)
333
- self == other_currency
334
- end
335
-
336
- # Returns a Fixnum hash value based on the +id+ attribute in order to use
337
- # functions like & (intersection), group_by, etc.
338
- #
339
- # @return [Fixnum]
340
- #
341
- # @example
342
- # Money::Currency.new(:usd).hash #=> 428936
343
- def hash
344
- id.hash
345
- end
346
-
347
- # Returns a string representation corresponding to the upcase +id+
348
- # attribute.
349
- #
350
- # -–
351
- # DEV: id.to_s.upcase corresponds to iso_code but don't use ISO_CODE for consistency.
352
- #
353
- # @return [String]
354
- #
355
- # @example
356
- # Money::Currency.new(:usd).to_s #=> "USD"
357
- # Money::Currency.new(:eur).to_s #=> "EUR"
358
- def to_s
359
- id.to_s.upcase
360
- end
361
-
362
- # Returns a human readable representation.
363
- #
364
- # @return [String]
365
- #
366
- # @example
367
- # Money::Currency.new(:usd) #=> #<Currency id: usd ...>
368
- def inspect
369
- "#<#{self.class.name} id: #{id}, priority: #{priority}, symbol_first: #{symbol_first}, thousands_separator: #{thousands_separator}, html_entity: #{html_entity}, decimal_mark: #{decimal_mark}, name: #{name}, symbol: #{symbol}, subunit_to_unit: #{subunit_to_unit}, iso_code: #{iso_code}, subunit: #{subunit}>"
370
- end
371
-
372
- # Class Methods
373
- class << self
374
-
375
- # Lookup a currency with given +id+ an returns a +Currency+ instance on
376
- # success, +nil+ otherwise.
377
- #
378
- # @param [String, Symbol, #to_s] id Used to look into +TABLE+ and
379
- # retrieve the applicable attributes.
380
- #
381
- # @return [Money::Currency]
382
- #
383
- # @example
384
- # Money::Currency.find(:eur) #=> #<Money::Currency id: eur ...>
385
- # Money::Currency.find(:foo) #=> nil
386
- def find(id)
387
- id = id.to_s.downcase.to_sym
388
- new(id) if self::TABLE[id]
389
- end
390
-
391
- # Wraps the object in a +Currency+ unless it's already a +Currency+
392
- # object.
393
- #
394
- # @param [Object] object The object to attempt and wrap as a +Currency+
395
- # object.
396
- #
397
- # @return [Money::Currency]
398
- #
399
- # @example
400
- # c1 = Money::Currency.new(:usd)
401
- # Money::Currency.wrap(nil) #=> nil
402
- # Money::Currency.wrap(c1) #=> #<Money::Currency id: usd ...>
403
- # Money::Currency.wrap("usd") #=> #<Money::Currency id: usd ...>
404
- def wrap(object)
405
- if object.nil?
406
- nil
407
- elsif object.is_a?(Currency)
408
- object
409
- else
410
- Currency.new(object)
411
- end
412
- end
413
- end
414
- end
415
- end
1
+ # encoding: utf-8
2
+
3
+ class Money
4
+
5
+ # Represents a specific currency unit.
6
+ class Currency
7
+ include Comparable
8
+
9
+ # Thrown when an unknown currency is requested.
10
+ class UnknownCurrency < StandardError; end
11
+
12
+ # List of known currencies.
13
+ #
14
+ # == monetary unit
15
+ # The standard unit of value of a currency, as the dollar in the United States or the peso in Mexico.
16
+ # http://www.answers.com/topic/monetary-unit
17
+ # == fractional monetary unit, subunit
18
+ # A monetary unit that is valued at a fraction (usually one hundredth) of the basic monetary unit
19
+ # http://www.answers.com/topic/fractional-monetary-unit-subunit
20
+ #
21
+ # See http://en.wikipedia.org/wiki/List_of_circulating_currencies and
22
+ # http://search.cpan.org/~tnguyen/Locale-Currency-Format-1.28/Format.pm
23
+
24
+ TABLE = {
25
+ :aed => { :priority => 100, :iso_code => "AED", :name => "United Arab Emirates Dirham", :symbol => "د.إ", :subunit => "Fils", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
26
+ :afn => { :priority => 100, :iso_code => "AFN", :name => "Afghan Afghani", :symbol => "؋", :subunit => "Pul", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
27
+ :all => { :priority => 100, :iso_code => "ALL", :name => "Albanian Lek", :symbol => "L", :subunit => "Qintar", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
28
+ :amd => { :priority => 100, :iso_code => "AMD", :name => "Armenian Dram", :symbol => "դր.", :subunit => "Luma", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
29
+ :ang => { :priority => 100, :iso_code => "ANG", :name => "Netherlands Antillean Gulden", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x0192;", :decimal_mark => ",", :thousands_separator => "."},
30
+ :aoa => { :priority => 100, :iso_code => "AOA", :name => "Angolan Kwanza", :symbol => "Kz", :subunit => "Cêntimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
31
+ :ars => { :priority => 100, :iso_code => "ARS", :name => "Argentine Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ",", :thousands_separator => "."},
32
+ :aud => { :priority => 4, :iso_code => "AUD", :name => "Australian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
33
+ :awg => { :priority => 100, :iso_code => "AWG", :name => "Aruban Florin", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x0192;", :decimal_mark => ".", :thousands_separator => ","},
34
+ :azn => { :priority => 100, :iso_code => "AZN", :name => "Azerbaijani Manat", :symbol => nil, :subunit => "Qəpik", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
35
+ :bam => { :priority => 100, :iso_code => "BAM", :name => "Bosnia and Herzegovina Convertible Mark", :symbol => "KM or КМ", :subunit => "Fening", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
36
+ :bbd => { :priority => 100, :iso_code => "BBD", :name => "Barbadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
37
+ :bdt => { :priority => 100, :iso_code => "BDT", :name => "Bangladeshi Taka", :symbol => "৳", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
38
+ :bgn => { :priority => 100, :iso_code => "BGN", :name => "Bulgarian Lev", :symbol => "лв", :subunit => "Stotinka", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
39
+ :bhd => { :priority => 100, :iso_code => "BHD", :name => "Bahraini Dinar", :symbol => "ب.د", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
40
+ :bif => { :priority => 100, :iso_code => "BIF", :name => "Burundian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
41
+ :bmd => { :priority => 100, :iso_code => "BMD", :name => "Bermudian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
42
+ :bnd => { :priority => 100, :iso_code => "BND", :name => "Brunei Dollar", :symbol => "$", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
43
+ :bob => { :priority => 100, :iso_code => "BOB", :name => "Bolivian Boliviano", :symbol => "Bs.", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
44
+ :brl => { :priority => 100, :iso_code => "BRL", :name => "Brazilian Real", :symbol => "R$ ", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "R\$", :decimal_mark => ",", :thousands_separator => "."},
45
+ :bsd => { :priority => 100, :iso_code => "BSD", :name => "Bahamian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
46
+ :btn => { :priority => 100, :iso_code => "BTN", :name => "Bhutanese Ngultrum", :symbol => nil, :subunit => "Chertrum", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
47
+ :bwp => { :priority => 100, :iso_code => "BWP", :name => "Botswana Pula", :symbol => "P", :subunit => "Thebe", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
48
+ :byr => { :priority => 100, :iso_code => "BYR", :name => "Belarusian Ruble", :symbol => "Br", :subunit => "Kapyeyka", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
49
+ :bzd => { :priority => 100, :iso_code => "BZD", :name => "Belize Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
50
+ :cad => { :priority => 5, :iso_code => "CAD", :name => "Canadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
51
+ :cdf => { :priority => 100, :iso_code => "CDF", :name => "Congolese Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
52
+ :chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
53
+ :clp => { :priority => 100, :iso_code => "CLP", :name => "Chilean Peso", :symbol => "$", :subunit => "Peso", :subunit_to_unit => 1, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ",", :thousands_separator => "."},
54
+ :cny => { :priority => 100, :iso_code => "CNY", :name => "Chinese Renminbi Yuan", :symbol => "¥", :subunit => "Fen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x5713;", :decimal_mark => ".", :thousands_separator => ","},
55
+ :cop => { :priority => 100, :iso_code => "COP", :name => "Colombian Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ",", :thousands_separator => "."},
56
+ :crc => { :priority => 100, :iso_code => "CRC", :name => "Costa Rican Colón", :symbol => "₡", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A1;", :decimal_mark => ",", :thousands_separator => "."},
57
+ :cuc => { :priority => 100, :iso_code => "CUC", :name => "Cuban Convertible Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
58
+ :cup => { :priority => 100, :iso_code => "CUP", :name => "Cuban Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ".", :thousands_separator => ","},
59
+ :cve => { :priority => 100, :iso_code => "CVE", :name => "Cape Verdean Escudo", :symbol => "$ or Esc", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
60
+ :czk => { :priority => 100, :iso_code => "CZK", :name => "Czech Koruna", :symbol => "Kč", :subunit => "Haléř", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
61
+ :djf => { :priority => 100, :iso_code => "DJF", :name => "Djiboutian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
62
+ :dkk => { :priority => 100, :iso_code => "DKK", :name => "Danish Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
63
+ :dop => { :priority => 100, :iso_code => "DOP", :name => "Dominican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ".", :thousands_separator => ","},
64
+ :dzd => { :priority => 100, :iso_code => "DZD", :name => "Algerian Dinar", :symbol => "د.ج", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
65
+ :eek => { :priority => 100, :iso_code => "EEK", :name => "Estonian Kroon", :symbol => "KR", :subunit => "Sent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
66
+ :egp => { :priority => 100, :iso_code => "EGP", :name => "Egyptian Pound", :symbol => "£ or ج.م", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
67
+ :ern => { :priority => 100, :iso_code => "ERN", :name => "Eritrean Nakfa", :symbol => "Nfk", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
68
+ :etb => { :priority => 100, :iso_code => "ETB", :name => "Ethiopian Birr", :symbol => nil, :subunit => "Santim", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
69
+ :eur => { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20AC;", :decimal_mark => ",", :thousands_separator => "."},
70
+ :fjd => { :priority => 100, :iso_code => "FJD", :name => "Fijian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
71
+ :fkp => { :priority => 100, :iso_code => "FKP", :name => "Falkland Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
72
+ :gbp => { :priority => 3, :iso_code => "GBP", :name => "British Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
73
+ :gel => { :priority => 100, :iso_code => "GEL", :name => "Georgian Lari", :symbol => "ლ", :subunit => "Tetri", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
74
+ :ghs => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B5;", :decimal_mark => ".", :thousands_separator => ","},
75
+ :gip => { :priority => 100, :iso_code => "GIP", :name => "Gibraltar Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
76
+ :gmd => { :priority => 100, :iso_code => "GMD", :name => "Gambian Dalasi", :symbol => "D", :subunit => "Butut", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
77
+ :gnf => { :priority => 100, :iso_code => "GNF", :name => "Guinean Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
78
+ :gtq => { :priority => 100, :iso_code => "GTQ", :name => "Guatemalan Quetzal", :symbol => "Q", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
79
+ :gyd => { :priority => 100, :iso_code => "GYD", :name => "Guyanese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
80
+ :hkd => { :priority => 100, :iso_code => "HKD", :name => "Hong Kong Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
81
+ :hnl => { :priority => 100, :iso_code => "HNL", :name => "Honduran Lempira", :symbol => "L", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
82
+ :hrk => { :priority => 100, :iso_code => "HRK", :name => "Croatian Kuna", :symbol => "kn", :subunit => "Lipa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
83
+ :htg => { :priority => 100, :iso_code => "HTG", :name => "Haitian Gourde", :symbol => "G", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
84
+ :huf => { :priority => 100, :iso_code => "HUF", :name => "Hungarian Forint", :symbol => "Ft", :subunit => "Fillér", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
85
+ :idr => { :priority => 100, :iso_code => "IDR", :name => "Indonesian Rupiah", :symbol => "Rp", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
86
+ :ils => { :priority => 100, :iso_code => "ILS", :name => "Israeli New Sheqel", :symbol => "₪", :subunit => "Agora", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20AA;", :decimal_mark => ".", :thousands_separator => ","},
87
+ :inr => { :priority => 100, :iso_code => "INR", :name => "Indian Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
88
+ :iqd => { :priority => 100, :iso_code => "IQD", :name => "Iraqi Dinar", :symbol => "ع.د", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
89
+ :irr => { :priority => 100, :iso_code => "IRR", :name => "Iranian Rial", :symbol => "﷼", :subunit => "Dinar", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
90
+ :isk => { :priority => 100, :iso_code => "ISK", :name => "Icelandic Króna", :symbol => "kr", :subunit => "Eyrir", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
91
+ :jmd => { :priority => 100, :iso_code => "JMD", :name => "Jamaican Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
92
+ :jod => { :priority => 100, :iso_code => "JOD", :name => "Jordanian Dinar", :symbol => "د.ا", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
93
+ :jpy => { :priority => 6, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A5;", :decimal_mark => ".", :thousands_separator => ","},
94
+ :kes => { :priority => 100, :iso_code => "KES", :name => "Kenyan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
95
+ :kgs => { :priority => 100, :iso_code => "KGS", :name => "Kyrgyzstani Som", :symbol => nil, :subunit => "Tyiyn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
96
+ :khr => { :priority => 100, :iso_code => "KHR", :name => "Cambodian Riel", :symbol => "៛", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x17DB;", :decimal_mark => ".", :thousands_separator => ","},
97
+ :kmf => { :priority => 100, :iso_code => "KMF", :name => "Comorian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
98
+ :kpw => { :priority => 100, :iso_code => "KPW", :name => "North Korean Won", :symbol => "₩", :subunit => "Chŏn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20A9;", :decimal_mark => ".", :thousands_separator => ","},
99
+ :krw => { :priority => 100, :iso_code => "KRW", :name => "South Korean Won", :symbol => "₩", :subunit => "Jeon", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A9;", :decimal_mark => ".", :thousands_separator => ","},
100
+ :kwd => { :priority => 100, :iso_code => "KWD", :name => "Kuwaiti Dinar", :symbol => "د.ك", :subunit => "Fils", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
101
+ :kyd => { :priority => 100, :iso_code => "KYD", :name => "Cayman Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
102
+ :kzt => { :priority => 100, :iso_code => "KZT", :name => "Kazakhstani Tenge", :symbol => "〒", :subunit => "Tiyn", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
103
+ :lak => { :priority => 100, :iso_code => "LAK", :name => "Lao Kip", :symbol => "₭", :subunit => "Att", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20AD;", :decimal_mark => ".", :thousands_separator => ","},
104
+ :lbp => { :priority => 100, :iso_code => "LBP", :name => "Lebanese Lira", :symbol => "ل.ل", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
105
+ :lkr => { :priority => 100, :iso_code => "LKR", :name => "Sri Lankan Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x0BF9;", :decimal_mark => ".", :thousands_separator => ","},
106
+ :lrd => { :priority => 100, :iso_code => "LRD", :name => "Liberian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
107
+ :lsl => { :priority => 100, :iso_code => "LSL", :name => "Lesotho Loti", :symbol => "L", :subunit => "Sente", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
108
+ :ltl => { :priority => 100, :iso_code => "LTL", :name => "Lithuanian Litas", :symbol => "Lt", :subunit => "Centas", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
109
+ :lvl => { :priority => 100, :iso_code => "LVL", :name => "Latvian Lats", :symbol => "Ls", :subunit => "Santīms", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
110
+ :lyd => { :priority => 100, :iso_code => "LYD", :name => "Libyan Dinar", :symbol => "ل.د", :subunit => "Dirham", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
111
+ :mad => { :priority => 100, :iso_code => "MAD", :name => "Moroccan Dirham", :symbol => "د.م.", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
112
+ :mdl => { :priority => 100, :iso_code => "MDL", :name => "Moldovan Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
113
+ :mga => { :priority => 100, :iso_code => "MGA", :name => "Malagasy Ariary", :symbol => nil, :subunit => "Iraimbilanja", :subunit_to_unit => 5, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
114
+ :mkd => { :priority => 100, :iso_code => "MKD", :name => "Macedonian Denar", :symbol => "ден", :subunit => "Deni", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
115
+ :mmk => { :priority => 100, :iso_code => "MMK", :name => "Myanmar Kyat", :symbol => "K", :subunit => "Pya", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
116
+ :mnt => { :priority => 100, :iso_code => "MNT", :name => "Mongolian Tögrög", :symbol => "₮", :subunit => "Möngö", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20AE;", :decimal_mark => ".", :thousands_separator => ","},
117
+ :mop => { :priority => 100, :iso_code => "MOP", :name => "Macanese Pataca", :symbol => "P", :subunit => "Avo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
118
+ :mro => { :priority => 100, :iso_code => "MRO", :name => "Mauritanian Ouguiya", :symbol => "UM", :subunit => "Khoums", :subunit_to_unit => 5, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
119
+ :mur => { :priority => 100, :iso_code => "MUR", :name => "Mauritian Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
120
+ :mvr => { :priority => 100, :iso_code => "MVR", :name => "Maldivian Rufiyaa", :symbol => "ރ.", :subunit => "Laari", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
121
+ :mwk => { :priority => 100, :iso_code => "MWK", :name => "Malawian Kwacha", :symbol => "MK", :subunit => "Tambala", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
122
+ :mxn => { :priority => 100, :iso_code => "MXN", :name => "Mexican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
123
+ :myr => { :priority => 100, :iso_code => "MYR", :name => "Malaysian Ringgit", :symbol => "RM", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
124
+ :mzn => { :priority => 100, :iso_code => "MZN", :name => "Mozambican Metical", :symbol => "MTn", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
125
+ :nad => { :priority => 100, :iso_code => "NAD", :name => "Namibian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
126
+ :ngn => { :priority => 100, :iso_code => "NGN", :name => "Nigerian Naira", :symbol => "₦", :subunit => "Kobo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20A6;", :decimal_mark => ".", :thousands_separator => ","},
127
+ :nio => { :priority => 100, :iso_code => "NIO", :name => "Nicaraguan Córdoba", :symbol => "C$", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
128
+ :nok => { :priority => 100, :iso_code => "NOK", :name => "Norwegian Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "kr", :decimal_mark => ",", :thousands_separator => "."},
129
+ :npr => { :priority => 100, :iso_code => "NPR", :name => "Nepalese Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
130
+ :nzd => { :priority => 100, :iso_code => "NZD", :name => "New Zealand Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
131
+ :omr => { :priority => 100, :iso_code => "OMR", :name => "Omani Rial", :symbol => "ر.ع.", :subunit => "Baisa", :subunit_to_unit => 1000, :symbol_first => true, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
132
+ :pab => { :priority => 100, :iso_code => "PAB", :name => "Panamanian Balboa", :symbol => "B/.", :subunit => "Centésimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
133
+ :pen => { :priority => 100, :iso_code => "PEN", :name => "Peruvian Nuevo Sol", :symbol => "S/.", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "S/.", :decimal_mark => ".", :thousands_separator => ","},
134
+ :pgk => { :priority => 100, :iso_code => "PGK", :name => "Papua New Guinean Kina", :symbol => "K", :subunit => "Toea", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
135
+ :php => { :priority => 100, :iso_code => "PHP", :name => "Philippine Peso", :symbol => "₱", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20B1;", :decimal_mark => ".", :thousands_separator => ","},
136
+ :pkr => { :priority => 100, :iso_code => "PKR", :name => "Pakistani Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
137
+ :pln => { :priority => 100, :iso_code => "PLN", :name => "Polish Złoty", :symbol => "zł", :subunit => "Grosz", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
138
+ :pyg => { :priority => 100, :iso_code => "PYG", :name => "Paraguayan Guaraní", :symbol => "₲", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B2;", :decimal_mark => ".", :thousands_separator => ","},
139
+ :qar => { :priority => 100, :iso_code => "QAR", :name => "Qatari Riyal", :symbol => "ر.ق", :subunit => "Dirham", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
140
+ :ron => { :priority => 100, :iso_code => "RON", :name => "Romanian Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
141
+ :rsd => { :priority => 100, :iso_code => "RSD", :name => "Serbian Dinar", :symbol => "din. or дин.", :subunit => "Para", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
142
+ :rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "р.", :subunit => "Kopek", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x0440;&#x0443;&#x0431;", :decimal_mark => ",", :thousands_separator => "."},
143
+ :rwf => { :priority => 100, :iso_code => "RWF", :name => "Rwandan Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
144
+ :sar => { :priority => 100, :iso_code => "SAR", :name => "Saudi Riyal", :symbol => "ر.س", :subunit => "Hallallah", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
145
+ :sbd => { :priority => 100, :iso_code => "SBD", :name => "Solomon Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
146
+ :scr => { :priority => 100, :iso_code => "SCR", :name => "Seychellois Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20A8;", :decimal_mark => ".", :thousands_separator => ","},
147
+ :sdg => { :priority => 100, :iso_code => "SDG", :name => "Sudanese Pound", :symbol => "£", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
148
+ :sek => { :priority => 100, :iso_code => "SEK", :name => "Swedish Krona", :symbol => "kr", :subunit => "Öre", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
149
+ :sgd => { :priority => 100, :iso_code => "SGD", :name => "Singapore Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
150
+ :shp => { :priority => 100, :iso_code => "SHP", :name => "Saint Helenian Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
151
+ :skk => { :priority => 100, :iso_code => "SKK", :name => "Slovak Koruna", :symbol => "Sk", :subunit => "Halier", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
152
+ :sll => { :priority => 100, :iso_code => "SLL", :name => "Sierra Leonean Leone", :symbol => "Le", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
153
+ :sos => { :priority => 100, :iso_code => "SOS", :name => "Somali Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
154
+ :srd => { :priority => 100, :iso_code => "SRD", :name => "Surinamese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
155
+ :std => { :priority => 100, :iso_code => "STD", :name => "São Tomé and Príncipe Dobra", :symbol => "Db", :subunit => "Cêntimo", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
156
+ :svc => { :priority => 100, :iso_code => "SVC", :name => "Salvadoran Colón", :symbol => "₡", :subunit => "Centavo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20A1;", :decimal_mark => ".", :thousands_separator => ","},
157
+ :syp => { :priority => 100, :iso_code => "SYP", :name => "Syrian Pound", :symbol => "£ or ل.س", :subunit => "Piastre", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x00A3;", :decimal_mark => ".", :thousands_separator => ","},
158
+ :szl => { :priority => 100, :iso_code => "SZL", :name => "Swazi Lilangeni", :symbol => "L", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
159
+ :thb => { :priority => 100, :iso_code => "THB", :name => "Thai Baht", :symbol => "฿", :subunit => "Satang", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x0E3F;", :decimal_mark => ".", :thousands_separator => ","},
160
+ :tjs => { :priority => 100, :iso_code => "TJS", :name => "Tajikistani Somoni", :symbol => "ЅМ", :subunit => "Diram", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
161
+ :tmm => { :priority => 100, :iso_code => "TMM", :name => "Turkmenistani Manat", :symbol => "m", :subunit => "Tennesi", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
162
+ :tnd => { :priority => 100, :iso_code => "TND", :name => "Tunisian Dinar", :symbol => "د.ت", :subunit => "Millime", :subunit_to_unit => 1000, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
163
+ :top => { :priority => 100, :iso_code => "TOP", :name => "Tongan Paʻanga", :symbol => "T$", :subunit => "Seniti", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
164
+ :try => { :priority => 100, :iso_code => "TRY", :name => "Turkish Lira", :symbol => "TL", :subunit => "kuruş", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
165
+ :ttd => { :priority => 100, :iso_code => "TTD", :name => "Trinidad and Tobago Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
166
+ :twd => { :priority => 100, :iso_code => "TWD", :name => "New Taiwan Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
167
+ :tzs => { :priority => 100, :iso_code => "TZS", :name => "Tanzanian Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
168
+ :uah => { :priority => 100, :iso_code => "UAH", :name => "Ukrainian Hryvnia", :symbol => "₴", :subunit => "Kopiyka", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#x20B4", :decimal_mark => ".", :thousands_separator => ","},
169
+ :ugx => { :priority => 100, :iso_code => "UGX", :name => "Ugandan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
170
+ :usd => { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
171
+ :uyu => { :priority => 100, :iso_code => "UYU", :name => "Uruguayan Peso", :symbol => "$", :subunit => "Centésimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B1;", :decimal_mark => ",", :thousands_separator => "."},
172
+ :uzs => { :priority => 100, :iso_code => "UZS", :name => "Uzbekistani Som", :symbol => nil, :subunit => "Tiyin", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
173
+ :vef => { :priority => 100, :iso_code => "VEF", :name => "Venezuelan Bolívar", :symbol => "Bs F", :subunit => "Céntimo", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
174
+ :vnd => { :priority => 100, :iso_code => "VND", :name => "Vietnamese Đồng", :symbol => "₫", :subunit => "Hào", :subunit_to_unit => 10, :symbol_first => true, :html_entity => "&#x20AB;", :decimal_mark => ",", :thousands_separator => "."},
175
+ :vuv => { :priority => 100, :iso_code => "VUV", :name => "Vanuatu Vatu", :symbol => "Vt", :subunit => nil, :subunit_to_unit => 1, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
176
+ :wst => { :priority => 100, :iso_code => "WST", :name => "Samoan Tala", :symbol => "T", :subunit => "Sene", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
177
+ :xaf => { :priority => 100, :iso_code => "XAF", :name => "Central African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
178
+ :xcd => { :priority => 100, :iso_code => "XCD", :name => "East Caribbean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
179
+ :xof => { :priority => 100, :iso_code => "XOF", :name => "West African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
180
+ :xpf => { :priority => 100, :iso_code => "XPF", :name => "Cfp Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
181
+ :yer => { :priority => 100, :iso_code => "YER", :name => "Yemeni Rial", :symbol => "﷼", :subunit => "Fils", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "&#xFDFC;", :decimal_mark => ".", :thousands_separator => ","},
182
+ :zar => { :priority => 100, :iso_code => "ZAR", :name => "South African Rand", :symbol => "R", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x0052;", :decimal_mark => ".", :thousands_separator => ","},
183
+ :zmk => { :priority => 100, :iso_code => "ZMK", :name => "Zambian Kwacha", :symbol => "ZK", :subunit => "Ngwee", :subunit_to_unit => 100, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
184
+ :zwd => { :priority => 100, :iso_code => "ZWD", :name => "Zimbabwean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
185
+
186
+ # aliases for BC with documentation before Currency
187
+ :yen => { :priority => 100, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x00A5;", :decimal_mark => ".", :thousands_separator => ","},
188
+
189
+ # kept for backwards compatibility, real entry is :ghs
190
+ :ghc => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :symbol_first => true, :html_entity => "&#x20B5;", :decimal_mark => ".", :thousands_separator => "," }
191
+ }
192
+
193
+
194
+ # The symbol used to identify the currency, usually the lowercase
195
+ # +iso_code+ attribute.
196
+ #
197
+ # @return [Symbol]
198
+ attr_reader :id
199
+
200
+ # A numerical value you can use to sort/group the currency list.
201
+ #
202
+ # @return [Integer]
203
+ attr_reader :priority
204
+
205
+ # The international 3-letter code as defined by the ISO 4217 standard.
206
+ #
207
+ # @return [String]
208
+ attr_reader :iso_code
209
+
210
+ # The currency name.
211
+ #
212
+ # @return [String]
213
+ attr_reader :name
214
+
215
+ # The currency symbol (UTF-8 encoded).
216
+ #
217
+ # @return [String]
218
+ attr_reader :symbol
219
+
220
+ # The html entity for the currency symbol
221
+ #
222
+ # @return [String]
223
+ attr_reader :html_entity
224
+
225
+ # The name of the fractional monetary unit.
226
+ #
227
+ # @return [String]
228
+ attr_reader :subunit
229
+
230
+ # The proportion between the unit and the subunit
231
+ #
232
+ # @return [Integer]
233
+ attr_reader :subunit_to_unit
234
+
235
+ # The decimal mark, or character used to separate the whole unit from the subunit.
236
+ #
237
+ # @return [String]
238
+ attr_reader :decimal_mark
239
+ alias :separator :decimal_mark
240
+
241
+ # The character used to separate thousands grouping of the whole unit.
242
+ #
243
+ # @return [String]
244
+ attr_reader :thousands_separator
245
+ alias :delimiter :thousands_separator
246
+
247
+ # Should the currency symbol precede the amount, or should it come after?
248
+ #
249
+ # @return [boolean]
250
+ attr_reader :symbol_first
251
+
252
+ def symbol_first?
253
+ !!@symbol_first
254
+ end
255
+
256
+ # The number of decimal places needed.
257
+ #
258
+ # @return [Integer]
259
+ def decimal_places
260
+ if subunit_to_unit == 1
261
+ 0
262
+ elsif subunit_to_unit % 10 == 0
263
+ Math.log10(subunit_to_unit).to_s.to_i
264
+ else
265
+ Math.log10(subunit_to_unit).to_s.to_i+1
266
+ end
267
+ end
268
+
269
+ # Create a new +Currency+ object.
270
+ #
271
+ # @param [String, Symbol, #to_s] id Used to look into +TABLE+ and retrieve
272
+ # the applicable attributes.
273
+ #
274
+ # @return [Money::Currency]
275
+ #
276
+ # @example
277
+ # Money::Currency.new(:usd) #=> #<Money::Currency id: usd ...>
278
+ def initialize(id)
279
+ @id = id.to_s.downcase.to_sym
280
+ data = TABLE[@id] || raise(UnknownCurrency, "Unknown currency `#{id}'")
281
+ data.each_pair do |key, value|
282
+ instance_variable_set(:"@#{key}", value)
283
+ end
284
+ end
285
+
286
+ # Compares +self+ with +other_currency+ against the value of +priority+
287
+ # attribute.
288
+ #
289
+ # @param [Money::Currency] other_currency The currency to compare to.
290
+ #
291
+ # @return [-1,0,1] -1 if less than, 0 is equal to, 1 if greater than
292
+ #
293
+ # @example
294
+ # c1 = Money::Currency.new(:usd)
295
+ # c2 = Money::Currency.new(:jpy)
296
+ # c1 <=> c2 #=> 1
297
+ # c2 <=> c1 #=> -1
298
+ # c1 <=> c1 #=> 0
299
+ def <=>(other_currency)
300
+ self.priority <=> other_currency.priority
301
+ end
302
+
303
+ # Compares +self+ with +other_currency+ and returns +true+ if the are the
304
+ # same or if their +id+ attributes match.
305
+ #
306
+ # @param [Money::Currency] other_currency The currency to compare to.
307
+ #
308
+ # @return [Boolean]
309
+ #
310
+ # @example
311
+ # c1 = Money::Currency.new(:usd)
312
+ # c2 = Money::Currency.new(:jpy)
313
+ # c1 == c1 #=> true
314
+ # c1 == c2 #=> false
315
+ def ==(other_currency)
316
+ self.equal?(other_currency) ||
317
+ self.id == other_currency.id
318
+ end
319
+
320
+ # Compares +self+ with +other_currency+ and returns +true+ if the are the
321
+ # same or if their +id+ attributes match.
322
+ #
323
+ # @param [Money::Currency] other_currency The currency to compare to.
324
+ #
325
+ # @return [Boolean]
326
+ #
327
+ # @example
328
+ # c1 = Money::Currency.new(:usd)
329
+ # c2 = Money::Currency.new(:jpy)
330
+ # c1.eql? c1 #=> true
331
+ # c1.eql? c2 #=> false
332
+ def eql?(other_currency)
333
+ self == other_currency
334
+ end
335
+
336
+ # Returns a Fixnum hash value based on the +id+ attribute in order to use
337
+ # functions like & (intersection), group_by, etc.
338
+ #
339
+ # @return [Fixnum]
340
+ #
341
+ # @example
342
+ # Money::Currency.new(:usd).hash #=> 428936
343
+ def hash
344
+ id.hash
345
+ end
346
+
347
+ # Returns a string representation corresponding to the upcase +id+
348
+ # attribute.
349
+ #
350
+ # -–
351
+ # DEV: id.to_s.upcase corresponds to iso_code but don't use ISO_CODE for consistency.
352
+ #
353
+ # @return [String]
354
+ #
355
+ # @example
356
+ # Money::Currency.new(:usd).to_s #=> "USD"
357
+ # Money::Currency.new(:eur).to_s #=> "EUR"
358
+ def to_s
359
+ id.to_s.upcase
360
+ end
361
+
362
+ # Conversation to +self+.
363
+ #
364
+ # @return [self]
365
+ def to_currency
366
+ self
367
+ end
368
+
369
+ # Returns a human readable representation.
370
+ #
371
+ # @return [String]
372
+ #
373
+ # @example
374
+ # Money::Currency.new(:usd) #=> #<Currency id: usd ...>
375
+ def inspect
376
+ "#<#{self.class.name} id: #{id}, priority: #{priority}, symbol_first: #{symbol_first}, thousands_separator: #{thousands_separator}, html_entity: #{html_entity}, decimal_mark: #{decimal_mark}, name: #{name}, symbol: #{symbol}, subunit_to_unit: #{subunit_to_unit}, iso_code: #{iso_code}, subunit: #{subunit}>"
377
+ end
378
+
379
+ # Class Methods
380
+ class << self
381
+
382
+ # Lookup a currency with given +id+ an returns a +Currency+ instance on
383
+ # success, +nil+ otherwise.
384
+ #
385
+ # @param [String, Symbol, #to_s] id Used to look into +TABLE+ and
386
+ # retrieve the applicable attributes.
387
+ #
388
+ # @return [Money::Currency]
389
+ #
390
+ # @example
391
+ # Money::Currency.find(:eur) #=> #<Money::Currency id: eur ...>
392
+ # Money::Currency.find(:foo) #=> nil
393
+ def find(id)
394
+ id = id.to_s.downcase.to_sym
395
+ new(id) if self::TABLE[id]
396
+ end
397
+
398
+ # Wraps the object in a +Currency+ unless it's already a +Currency+
399
+ # object.
400
+ #
401
+ # @param [Object] object The object to attempt and wrap as a +Currency+
402
+ # object.
403
+ #
404
+ # @return [Money::Currency]
405
+ #
406
+ # @example
407
+ # c1 = Money::Currency.new(:usd)
408
+ # Money::Currency.wrap(nil) #=> nil
409
+ # Money::Currency.wrap(c1) #=> #<Money::Currency id: usd ...>
410
+ # Money::Currency.wrap("usd") #=> #<Money::Currency id: usd ...>
411
+ def wrap(object)
412
+ if object.nil?
413
+ nil
414
+ elsif object.is_a?(Currency)
415
+ object
416
+ else
417
+ Currency.new(object)
418
+ end
419
+ end
420
+ end
421
+ end
422
+ end