simple_money 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +8 -0
- data/lib/simple_money/currency.rb +219 -0
- data/lib/simple_money/money.rb +74 -6
- metadata +55 -54
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,219 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Currency
|
4
|
+
extend self
|
5
|
+
|
6
|
+
CURRENCIES = {
|
7
|
+
:aed => { :priority => 100, :iso_code => "AED", :name => "United Arab Emirates Dirham", :symbol => "د.إ", :subunit => "Fils", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
8
|
+
:afn => { :priority => 100, :iso_code => "AFN", :name => "Afghan Afghani", :symbol => "؋", :subunit => "Pul", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
9
|
+
:all => { :priority => 100, :iso_code => "ALL", :name => "Albanian Lek", :symbol => "L", :subunit => "Qintar", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
10
|
+
:amd => { :priority => 100, :iso_code => "AMD", :name => "Armenian Dram", :symbol => "դր.", :subunit => "Luma", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
11
|
+
:ang => { :priority => 100, :iso_code => "ANG", :name => "Netherlands Antillean Gulden", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "ƒ", :decimal_mark => ",", :thousands_separator => "."},
|
12
|
+
:aoa => { :priority => 100, :iso_code => "AOA", :name => "Angolan Kwanza", :symbol => "Kz", :subunit => "Cêntimo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
13
|
+
:ars => { :priority => 100, :iso_code => "ARS", :name => "Argentine Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₱", :decimal_mark => ",", :thousands_separator => "."},
|
14
|
+
:aud => { :priority => 4, :iso_code => "AUD", :name => "Australian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
15
|
+
:awg => { :priority => 100, :iso_code => "AWG", :name => "Aruban Florin", :symbol => "ƒ", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "ƒ", :decimal_mark => ".", :thousands_separator => ","},
|
16
|
+
:azn => { :priority => 100, :iso_code => "AZN", :name => "Azerbaijani Manat", :symbol => nil, :subunit => "Qəpik", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
17
|
+
:bam => { :priority => 100, :iso_code => "BAM", :name => "Bosnia and Herzegovina Convertible Mark", :symbol => "KM or КМ", :subunit => "Fening", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
18
|
+
:bbd => { :priority => 100, :iso_code => "BBD", :name => "Barbadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
19
|
+
:bdt => { :priority => 100, :iso_code => "BDT", :name => "Bangladeshi Taka", :symbol => "৳", :subunit => "Paisa", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
20
|
+
:bgn => { :priority => 100, :iso_code => "BGN", :name => "Bulgarian Lev", :symbol => "лв", :subunit => "Stotinka", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
21
|
+
:bhd => { :priority => 100, :iso_code => "BHD", :name => "Bahraini Dinar", :symbol => "ب.د", :subunit => "Fils", :subunit_to_unit => 1000, :decimal_places => 3, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
22
|
+
:bif => { :priority => 100, :iso_code => "BIF", :name => "Burundian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
23
|
+
:bmd => { :priority => 100, :iso_code => "BMD", :name => "Bermudian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
24
|
+
:bnd => { :priority => 100, :iso_code => "BND", :name => "Brunei Dollar", :symbol => "$", :subunit => "Sen", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
25
|
+
:bob => { :priority => 100, :iso_code => "BOB", :name => "Bolivian Boliviano", :symbol => "Bs.", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
26
|
+
:brl => { :priority => 100, :iso_code => "BRL", :name => "Brazilian Real", :symbol => "R$ ", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "R\$", :decimal_mark => ",", :thousands_separator => "."},
|
27
|
+
:bsd => { :priority => 100, :iso_code => "BSD", :name => "Bahamian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
28
|
+
:btn => { :priority => 100, :iso_code => "BTN", :name => "Bhutanese Ngultrum", :symbol => nil, :subunit => "Chertrum", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
29
|
+
:bwp => { :priority => 100, :iso_code => "BWP", :name => "Botswana Pula", :symbol => "P", :subunit => "Thebe", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
30
|
+
:byr => { :priority => 100, :iso_code => "BYR", :name => "Belarusian Ruble", :symbol => "Br", :subunit => "Kapyeyka", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
31
|
+
:bzd => { :priority => 100, :iso_code => "BZD", :name => "Belize Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
32
|
+
:cad => { :priority => 5, :iso_code => "CAD", :name => "Canadian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
33
|
+
:cdf => { :priority => 100, :iso_code => "CDF", :name => "Congolese Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
34
|
+
:chf => { :priority => 100, :iso_code => "CHF", :name => "Swiss Franc", :symbol => "Fr", :subunit => "Rappen", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
35
|
+
:clp => { :priority => 100, :iso_code => "CLP", :name => "Chilean Peso", :symbol => "$", :subunit => "Peso", :subunit_to_unit => 1, :decimal_places => 0, :symbol_first => true, :html_entity => "₱", :decimal_mark => ",", :thousands_separator => "."},
|
36
|
+
:cny => { :priority => 100, :iso_code => "CNY", :name => "Chinese Renminbi Yuan", :symbol => "¥", :subunit => "Jiao", :subunit_to_unit => 10, :decimal_places => 1, :symbol_first => true, :html_entity => "圓", :decimal_mark => ".", :thousands_separator => ","},
|
37
|
+
:cop => { :priority => 100, :iso_code => "COP", :name => "Colombian Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₱", :decimal_mark => ",", :thousands_separator => "."},
|
38
|
+
:crc => { :priority => 100, :iso_code => "CRC", :name => "Costa Rican Colón", :symbol => "₡", :subunit => "Céntimo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₡", :decimal_mark => ",", :thousands_separator => "."},
|
39
|
+
:cuc => { :priority => 100, :iso_code => "CUC", :name => "Cuban Convertible Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
40
|
+
:cup => { :priority => 100, :iso_code => "CUP", :name => "Cuban Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₱", :decimal_mark => ".", :thousands_separator => ","},
|
41
|
+
:cve => { :priority => 100, :iso_code => "CVE", :name => "Cape Verdean Escudo", :symbol => "$ or Esc", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
42
|
+
:czk => { :priority => 100, :iso_code => "CZK", :name => "Czech Koruna", :symbol => "Kč", :subunit => "Haléř", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
43
|
+
:djf => { :priority => 100, :iso_code => "DJF", :name => "Djiboutian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
44
|
+
:dkk => { :priority => 100, :iso_code => "DKK", :name => "Danish Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
45
|
+
:dop => { :priority => 100, :iso_code => "DOP", :name => "Dominican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₱", :decimal_mark => ".", :thousands_separator => ","},
|
46
|
+
:dzd => { :priority => 100, :iso_code => "DZD", :name => "Algerian Dinar", :symbol => "د.ج", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
47
|
+
:eek => { :priority => 100, :iso_code => "EEK", :name => "Estonian Kroon", :symbol => "KR", :subunit => "Sent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
48
|
+
:egp => { :priority => 100, :iso_code => "EGP", :name => "Egyptian Pound", :symbol => "£ or ج.م", :subunit => "Piastre", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
49
|
+
:ern => { :priority => 100, :iso_code => "ERN", :name => "Eritrean Nakfa", :symbol => "Nfk", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
50
|
+
:etb => { :priority => 100, :iso_code => "ETB", :name => "Ethiopian Birr", :symbol => nil, :subunit => "Santim", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
51
|
+
:eur => { :priority => 2, :iso_code => "EUR", :name => "Euro", :symbol => "€", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "€", :decimal_mark => ",", :thousands_separator => "."},
|
52
|
+
:fjd => { :priority => 100, :iso_code => "FJD", :name => "Fijian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
53
|
+
:fkp => { :priority => 100, :iso_code => "FKP", :name => "Falkland Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
54
|
+
:gbp => { :priority => 3, :iso_code => "GBP", :name => "British Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
55
|
+
:gel => { :priority => 100, :iso_code => "GEL", :name => "Georgian Lari", :symbol => "ლ", :subunit => "Tetri", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
56
|
+
:ghs => { :priority => 100, :iso_code => "GHS", :name => "Ghanaian Cedi", :symbol => "₵", :subunit => "Pesewa", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₵", :decimal_mark => ".", :thousands_separator => ","},
|
57
|
+
:gip => { :priority => 100, :iso_code => "GIP", :name => "Gibraltar Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
58
|
+
:gmd => { :priority => 100, :iso_code => "GMD", :name => "Gambian Dalasi", :symbol => "D", :subunit => "Butut", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
59
|
+
:gnf => { :priority => 100, :iso_code => "GNF", :name => "Guinean Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
60
|
+
:gtq => { :priority => 100, :iso_code => "GTQ", :name => "Guatemalan Quetzal", :symbol => "Q", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
61
|
+
:gyd => { :priority => 100, :iso_code => "GYD", :name => "Guyanese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
62
|
+
:hkd => { :priority => 100, :iso_code => "HKD", :name => "Hong Kong Dollar", :symbol => "$", :subunit => "Ho", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
63
|
+
:hnl => { :priority => 100, :iso_code => "HNL", :name => "Honduran Lempira", :symbol => "L", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
64
|
+
:hrk => { :priority => 100, :iso_code => "HRK", :name => "Croatian Kuna", :symbol => "kn", :subunit => "Lipa", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
65
|
+
:htg => { :priority => 100, :iso_code => "HTG", :name => "Haitian Gourde", :symbol => "G", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
66
|
+
:huf => { :priority => 100, :iso_code => "HUF", :name => "Hungarian Forint", :symbol => "Ft", :subunit => "Fillér", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
67
|
+
:idr => { :priority => 100, :iso_code => "IDR", :name => "Indonesian Rupiah", :symbol => "Rp", :subunit => "Sen", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
68
|
+
:ils => { :priority => 100, :iso_code => "ILS", :name => "Israeli New Sheqel", :symbol => "₪", :subunit => "Agora", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₪", :decimal_mark => ".", :thousands_separator => ","},
|
69
|
+
:inr => { :priority => 100, :iso_code => "INR", :name => "Indian Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
70
|
+
:iqd => { :priority => 100, :iso_code => "IQD", :name => "Iraqi Dinar", :symbol => "ع.د", :subunit => "Fils", :subunit_to_unit => 1000, :decimal_places => 3, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
71
|
+
:irr => { :priority => 100, :iso_code => "IRR", :name => "Iranian Rial", :symbol => "﷼", :subunit => "Dinar", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
72
|
+
:isk => { :priority => 100, :iso_code => "ISK", :name => "Icelandic Króna", :symbol => "kr", :subunit => "Eyrir", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
73
|
+
:jmd => { :priority => 100, :iso_code => "JMD", :name => "Jamaican Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
74
|
+
:jod => { :priority => 100, :iso_code => "JOD", :name => "Jordanian Dinar", :symbol => "د.ا", :subunit => "Piastre", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
75
|
+
:jpy => { :priority => 6, :iso_code => "JPY", :name => "Japanese Yen", :symbol => "¥", :subunit => "Sen", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "¥", :decimal_mark => ".", :thousands_separator => ","},
|
76
|
+
:kes => { :priority => 100, :iso_code => "KES", :name => "Kenyan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
77
|
+
:kgs => { :priority => 100, :iso_code => "KGS", :name => "Kyrgyzstani Som", :symbol => nil, :subunit => "Tyiyn", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
78
|
+
:khr => { :priority => 100, :iso_code => "KHR", :name => "Cambodian Riel", :symbol => "៛", :subunit => "Sen", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "៛", :decimal_mark => ".", :thousands_separator => ","},
|
79
|
+
:kmf => { :priority => 100, :iso_code => "KMF", :name => "Comorian Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
80
|
+
:kpw => { :priority => 100, :iso_code => "KPW", :name => "North Korean Won", :symbol => "₩", :subunit => "Chŏn", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "₩", :decimal_mark => ".", :thousands_separator => ","},
|
81
|
+
:krw => { :priority => 100, :iso_code => "KRW", :name => "South Korean Won", :symbol => "₩", :subunit => "Jeon", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₩", :decimal_mark => ".", :thousands_separator => ","},
|
82
|
+
:kwd => { :priority => 100, :iso_code => "KWD", :name => "Kuwaiti Dinar", :symbol => "د.ك", :subunit => "Fils", :subunit_to_unit => 1000, :decimal_places => 3, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
83
|
+
:kyd => { :priority => 100, :iso_code => "KYD", :name => "Cayman Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
84
|
+
:kzt => { :priority => 100, :iso_code => "KZT", :name => "Kazakhstani Tenge", :symbol => "〒", :subunit => "Tiyn", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
85
|
+
:lak => { :priority => 100, :iso_code => "LAK", :name => "Lao Kip", :symbol => "₭", :subunit => "Att", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "₭", :decimal_mark => ".", :thousands_separator => ","},
|
86
|
+
:lbp => { :priority => 100, :iso_code => "LBP", :name => "Lebanese Lira", :symbol => "ل.ل", :subunit => "Piastre", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
87
|
+
:lkr => { :priority => 100, :iso_code => "LKR", :name => "Sri Lankan Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "௹", :decimal_mark => ".", :thousands_separator => ","},
|
88
|
+
:lrd => { :priority => 100, :iso_code => "LRD", :name => "Liberian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
89
|
+
:lsl => { :priority => 100, :iso_code => "LSL", :name => "Lesotho Loti", :symbol => "L", :subunit => "Sente", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
90
|
+
:ltl => { :priority => 100, :iso_code => "LTL", :name => "Lithuanian Litas", :symbol => "Lt", :subunit => "Centas", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
91
|
+
:lvl => { :priority => 100, :iso_code => "LVL", :name => "Latvian Lats", :symbol => "Ls", :subunit => "Santīms", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
92
|
+
:lyd => { :priority => 100, :iso_code => "LYD", :name => "Libyan Dinar", :symbol => "ل.د", :subunit => "Dirham", :subunit_to_unit => 1000, :decimal_places => 3, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
93
|
+
:mad => { :priority => 100, :iso_code => "MAD", :name => "Moroccan Dirham", :symbol => "د.م.", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
94
|
+
:mdl => { :priority => 100, :iso_code => "MDL", :name => "Moldovan Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
95
|
+
:mga => { :priority => 100, :iso_code => "MGA", :name => "Malagasy Ariary", :symbol => nil, :subunit => "Iraimbilanja", :subunit_to_unit => 5, :decimal_places => 1, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
96
|
+
:mkd => { :priority => 100, :iso_code => "MKD", :name => "Macedonian Denar", :symbol => "ден", :subunit => "Deni", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
97
|
+
:mmk => { :priority => 100, :iso_code => "MMK", :name => "Myanmar Kyat", :symbol => "K", :subunit => "Pya", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
98
|
+
:mnt => { :priority => 100, :iso_code => "MNT", :name => "Mongolian Tögrög", :symbol => "₮", :subunit => "Möngö", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "₮", :decimal_mark => ".", :thousands_separator => ","},
|
99
|
+
:mop => { :priority => 100, :iso_code => "MOP", :name => "Macanese Pataca", :symbol => "P", :subunit => "Avo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
100
|
+
:mro => { :priority => 100, :iso_code => "MRO", :name => "Mauritanian Ouguiya", :symbol => "UM", :subunit => "Khoums", :subunit_to_unit => 5, :decimal_places => 1, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
101
|
+
:mur => { :priority => 100, :iso_code => "MUR", :name => "Mauritian Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
102
|
+
:mvr => { :priority => 100, :iso_code => "MVR", :name => "Maldivian Rufiyaa", :symbol => "ރ.", :subunit => "Laari", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
103
|
+
:mwk => { :priority => 100, :iso_code => "MWK", :name => "Malawian Kwacha", :symbol => "MK", :subunit => "Tambala", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
104
|
+
:mxn => { :priority => 100, :iso_code => "MXN", :name => "Mexican Peso", :symbol => "$", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
105
|
+
:myr => { :priority => 100, :iso_code => "MYR", :name => "Malaysian Ringgit", :symbol => "RM", :subunit => "Sen", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
106
|
+
:mzn => { :priority => 100, :iso_code => "MZN", :name => "Mozambican Metical", :symbol => "MTn", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
107
|
+
:nad => { :priority => 100, :iso_code => "NAD", :name => "Namibian Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
108
|
+
:ngn => { :priority => 100, :iso_code => "NGN", :name => "Nigerian Naira", :symbol => "₦", :subunit => "Kobo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "₦", :decimal_mark => ".", :thousands_separator => ","},
|
109
|
+
:nio => { :priority => 100, :iso_code => "NIO", :name => "Nicaraguan Córdoba", :symbol => "C$", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
110
|
+
:nok => { :priority => 100, :iso_code => "NOK", :name => "Norwegian Krone", :symbol => "kr", :subunit => "Øre", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "kr", :decimal_mark => ",", :thousands_separator => "."},
|
111
|
+
:npr => { :priority => 100, :iso_code => "NPR", :name => "Nepalese Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
112
|
+
:nzd => { :priority => 100, :iso_code => "NZD", :name => "New Zealand Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
113
|
+
:omr => { :priority => 100, :iso_code => "OMR", :name => "Omani Rial", :symbol => "ر.ع.", :subunit => "Baisa", :subunit_to_unit => 1000, :decimal_places => 3, :symbol_first => true, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
114
|
+
:pab => { :priority => 100, :iso_code => "PAB", :name => "Panamanian Balboa", :symbol => "B/.", :subunit => "Centésimo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
115
|
+
:pen => { :priority => 100, :iso_code => "PEN", :name => "Peruvian Nuevo Sol", :symbol => "S/.", :subunit => "Céntimo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "S/.", :decimal_mark => ".", :thousands_separator => ","},
|
116
|
+
:pgk => { :priority => 100, :iso_code => "PGK", :name => "Papua New Guinean Kina", :symbol => "K", :subunit => "Toea", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
117
|
+
:php => { :priority => 100, :iso_code => "PHP", :name => "Philippine Peso", :symbol => "₱", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "₱", :decimal_mark => ".", :thousands_separator => ","},
|
118
|
+
:pkr => { :priority => 100, :iso_code => "PKR", :name => "Pakistani Rupee", :symbol => "₨", :subunit => "Paisa", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
119
|
+
:pln => { :priority => 100, :iso_code => "PLN", :name => "Polish Złoty", :symbol => "zł", :subunit => "Grosz", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
120
|
+
:pyg => { :priority => 100, :iso_code => "PYG", :name => "Paraguayan Guaraní", :symbol => "₲", :subunit => "Céntimo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₲", :decimal_mark => ".", :thousands_separator => ","},
|
121
|
+
:qar => { :priority => 100, :iso_code => "QAR", :name => "Qatari Riyal", :symbol => "ر.ق", :subunit => "Dirham", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
122
|
+
:ron => { :priority => 100, :iso_code => "RON", :name => "Romanian Leu", :symbol => "L", :subunit => "Ban", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
123
|
+
:rsd => { :priority => 100, :iso_code => "RSD", :name => "Serbian Dinar", :symbol => "din. or дин.", :subunit => "Para", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
124
|
+
:rub => { :priority => 100, :iso_code => "RUB", :name => "Russian Ruble", :symbol => "р.", :subunit => "Kopek", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "руб", :decimal_mark => ",", :thousands_separator => "."},
|
125
|
+
:rwf => { :priority => 100, :iso_code => "RWF", :name => "Rwandan Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
126
|
+
:sar => { :priority => 100, :iso_code => "SAR", :name => "Saudi Riyal", :symbol => "ر.س", :subunit => "Hallallah", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
127
|
+
:sbd => { :priority => 100, :iso_code => "SBD", :name => "Solomon Islands Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
128
|
+
:scr => { :priority => 100, :iso_code => "SCR", :name => "Seychellois Rupee", :symbol => "₨", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "₨", :decimal_mark => ".", :thousands_separator => ","},
|
129
|
+
:sdg => { :priority => 100, :iso_code => "SDG", :name => "Sudanese Pound", :symbol => "£", :subunit => "Piastre", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
130
|
+
:sek => { :priority => 100, :iso_code => "SEK", :name => "Swedish Krona", :symbol => "kr", :subunit => "Öre", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
131
|
+
:sgd => { :priority => 100, :iso_code => "SGD", :name => "Singapore Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
132
|
+
:shp => { :priority => 100, :iso_code => "SHP", :name => "Saint Helenian Pound", :symbol => "£", :subunit => "Penny", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
133
|
+
:skk => { :priority => 100, :iso_code => "SKK", :name => "Slovak Koruna", :symbol => "Sk", :subunit => "Halier", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
134
|
+
:sll => { :priority => 100, :iso_code => "SLL", :name => "Sierra Leonean Leone", :symbol => "Le", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
135
|
+
:sos => { :priority => 100, :iso_code => "SOS", :name => "Somali Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
136
|
+
:srd => { :priority => 100, :iso_code => "SRD", :name => "Surinamese Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
137
|
+
:std => { :priority => 100, :iso_code => "STD", :name => "São Tomé and Príncipe Dobra", :symbol => "Db", :subunit => "Cêntimo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
138
|
+
:svc => { :priority => 100, :iso_code => "SVC", :name => "Salvadoran Colón", :symbol => "₡", :subunit => "Centavo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₡", :decimal_mark => ".", :thousands_separator => ","},
|
139
|
+
:syp => { :priority => 100, :iso_code => "SYP", :name => "Syrian Pound", :symbol => "£ or ل.س", :subunit => "Piastre", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "£", :decimal_mark => ".", :thousands_separator => ","},
|
140
|
+
:szl => { :priority => 100, :iso_code => "SZL", :name => "Swazi Lilangeni", :symbol => "L", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
141
|
+
:thb => { :priority => 100, :iso_code => "THB", :name => "Thai Baht", :symbol => "฿", :subunit => "Satang", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "฿", :decimal_mark => ".", :thousands_separator => ","},
|
142
|
+
:tjs => { :priority => 100, :iso_code => "TJS", :name => "Tajikistani Somoni", :symbol => "ЅМ", :subunit => "Diram", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
143
|
+
:tmm => { :priority => 100, :iso_code => "TMM", :name => "Turkmenistani Manat", :symbol => "m", :subunit => "Tennesi", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
144
|
+
:tnd => { :priority => 100, :iso_code => "TND", :name => "Tunisian Dinar", :symbol => "د.ت", :subunit => "Millime", :subunit_to_unit => 1000, :decimal_places => 3, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
145
|
+
:top => { :priority => 100, :iso_code => "TOP", :name => "Tongan Paʻanga", :symbol => "T$", :subunit => "Seniti", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
146
|
+
:try => { :priority => 100, :iso_code => "TRY", :name => "Turkish New Lira", :symbol => "YTL", :subunit => "New kuruş", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
147
|
+
:ttd => { :priority => 100, :iso_code => "TTD", :name => "Trinidad and Tobago Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
148
|
+
:twd => { :priority => 100, :iso_code => "TWD", :name => "New Taiwan Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
149
|
+
:tzs => { :priority => 100, :iso_code => "TZS", :name => "Tanzanian Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
150
|
+
:uah => { :priority => 100, :iso_code => "UAH", :name => "Ukrainian Hryvnia", :symbol => "₴", :subunit => "Kopiyka", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "₴", :decimal_mark => ".", :thousands_separator => ","},
|
151
|
+
:ugx => { :priority => 100, :iso_code => "UGX", :name => "Ugandan Shilling", :symbol => "Sh", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
152
|
+
:usd => { :priority => 1, :iso_code => "USD", :name => "United States Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
153
|
+
:uyu => { :priority => 100, :iso_code => "UYU", :name => "Uruguayan Peso", :symbol => "$", :subunit => "Centésimo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "₱", :decimal_mark => ",", :thousands_separator => "."},
|
154
|
+
:uzs => { :priority => 100, :iso_code => "UZS", :name => "Uzbekistani Som", :symbol => nil, :subunit => "Tiyin", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
155
|
+
:vef => { :priority => 100, :iso_code => "VEF", :name => "Venezuelan Bolívar", :symbol => "Bs F", :subunit => "Céntimo", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "", :decimal_mark => ",", :thousands_separator => "."},
|
156
|
+
:vnd => { :priority => 100, :iso_code => "VND", :name => "Vietnamese Đồng", :symbol => "₫", :subunit => "Hào", :subunit_to_unit => 10, :decimal_places => 1, :symbol_first => true, :html_entity => "₫", :decimal_mark => ",", :thousands_separator => "."},
|
157
|
+
:vuv => { :priority => 100, :iso_code => "VUV", :name => "Vanuatu Vatu", :symbol => "Vt", :subunit => nil, :subunit_to_unit => 1, :decimal_places => 0, :symbol_first => true, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
158
|
+
:wst => { :priority => 100, :iso_code => "WST", :name => "Samoan Tala", :symbol => "T", :subunit => "Sene", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
159
|
+
:xaf => { :priority => 100, :iso_code => "XAF", :name => "Central African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
160
|
+
:xcd => { :priority => 100, :iso_code => "XCD", :name => "East Caribbean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
161
|
+
:xof => { :priority => 100, :iso_code => "XOF", :name => "West African Cfa Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
162
|
+
:xpf => { :priority => 100, :iso_code => "XPF", :name => "Cfp Franc", :symbol => "Fr", :subunit => "Centime", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
163
|
+
:yer => { :priority => 100, :iso_code => "YER", :name => "Yemeni Rial", :symbol => "﷼", :subunit => "Fils", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "﷼", :decimal_mark => ".", :thousands_separator => ","},
|
164
|
+
:zar => { :priority => 100, :iso_code => "ZAR", :name => "South African Rand", :symbol => "R", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "R", :decimal_mark => ".", :thousands_separator => ","},
|
165
|
+
:zmk => { :priority => 100, :iso_code => "ZMK", :name => "Zambian Kwacha", :symbol => "ZK", :subunit => "Ngwee", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => false, :html_entity => "", :decimal_mark => ".", :thousands_separator => ","},
|
166
|
+
:zwd => { :priority => 100, :iso_code => "ZWD", :name => "Zimbabwean Dollar", :symbol => "$", :subunit => "Cent", :subunit_to_unit => 100, :decimal_places => 2, :symbol_first => true, :html_entity => "$", :decimal_mark => ".", :thousands_separator => ","},
|
167
|
+
}
|
168
|
+
|
169
|
+
CurrencyStruct = Struct.new(
|
170
|
+
:priority,
|
171
|
+
:iso_code,
|
172
|
+
:name,
|
173
|
+
:symbol,
|
174
|
+
:subunit,
|
175
|
+
:subunit_to_unit,
|
176
|
+
:decimal_places,
|
177
|
+
:symbol_first,
|
178
|
+
:html_entity,
|
179
|
+
:decimal_mark,
|
180
|
+
:thousands_separator
|
181
|
+
)
|
182
|
+
|
183
|
+
##
|
184
|
+
# Returns information pertaining to the requested currency.
|
185
|
+
#
|
186
|
+
# @param [#to_s] id The ID of the currency to fetch (ie "USD", :USD, :usd,
|
187
|
+
# "usd").
|
188
|
+
#
|
189
|
+
# @return [Hash]
|
190
|
+
#
|
191
|
+
# @example
|
192
|
+
# Currency[:usd] #=> {
|
193
|
+
# :priority => 1,
|
194
|
+
# :iso_code => "USD",
|
195
|
+
# :name => "United States Dollar",
|
196
|
+
# :symbol => "$",
|
197
|
+
# :subunit => "Cent",
|
198
|
+
# :subunit_to_unit => 100,
|
199
|
+
# :decimal_places => 2,
|
200
|
+
# :symbol_first => true,
|
201
|
+
# :html_entity => "$",
|
202
|
+
# :decimal_mark => ".",
|
203
|
+
# :thousands_separator => ","
|
204
|
+
# }
|
205
|
+
def [](id)
|
206
|
+
return id if id.is_a? CurrencyStruct
|
207
|
+
|
208
|
+
@currency ||= {}
|
209
|
+
@currency[id] ||= lambda{|id|
|
210
|
+
h = CURRENCIES[id]
|
211
|
+
raise ArgumentError, "unknown CURRENCY `#{id}`" if h.nil?
|
212
|
+
|
213
|
+
c = CurrencyStruct.new
|
214
|
+
h.each{|k,v| c[k] = v}
|
215
|
+
c
|
216
|
+
}.call(id.to_s.downcase.to_sym)
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
data/lib/simple_money/money.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'bigdecimal'
|
2
|
+
require 'simple_money/currency'
|
2
3
|
|
3
4
|
##
|
4
5
|
# Used to work with financial calculations. Tries to avoid the pitfalls of
|
@@ -107,6 +108,25 @@ class Money
|
|
107
108
|
VALID_ROUNDING_METHOD_VALUES.include? rounding_method
|
108
109
|
end
|
109
110
|
|
111
|
+
##
|
112
|
+
# The default currency used to create a new Money object (default to :usd).
|
113
|
+
attr_reader :default_currency
|
114
|
+
|
115
|
+
##
|
116
|
+
# Set the default currency used to create a new Money object.
|
117
|
+
#
|
118
|
+
# @param [Currency::CurrencyStruct,#to_s] id The CurrencyStruct or id of
|
119
|
+
# the desired default currency.
|
120
|
+
#
|
121
|
+
# @return [Currency::CurrencyStruct]
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
# Money.default_currency = :usd
|
125
|
+
# Money.default_currency #=> #<CurrencyStruct:... id: :usd, ...>
|
126
|
+
def default_currency=(id)
|
127
|
+
@default_currency = Currency[id]
|
128
|
+
end
|
129
|
+
|
110
130
|
##
|
111
131
|
# @return [BigDecimal] The factional cents left over from any transactions
|
112
132
|
# that overflowed.
|
@@ -169,6 +189,7 @@ class Money
|
|
169
189
|
end
|
170
190
|
@default_as = :cents
|
171
191
|
@default_rounding_method = :bankers
|
192
|
+
@default_currency = :usd
|
172
193
|
@overflow = BigDecimal("0")
|
173
194
|
|
174
195
|
##
|
@@ -180,6 +201,11 @@ class Money
|
|
180
201
|
# fractions of a cent.
|
181
202
|
attr_reader :rounding_method
|
182
203
|
|
204
|
+
##
|
205
|
+
# @return [Currency::CurrencyStruct] The currency representation the object
|
206
|
+
# was created using.
|
207
|
+
attr_reader :currency
|
208
|
+
|
183
209
|
##
|
184
210
|
# Creates a new Money object. If as is set to :cents, n will be coerced to a
|
185
211
|
# Fixnum. If as is set to :decimal, n will be coerced to a BigDecimal.
|
@@ -190,6 +216,8 @@ class Money
|
|
190
216
|
# self.class.default_as).
|
191
217
|
# @option options [Symbol] :rounding_method How any calculations resulting in
|
192
218
|
# fractions of a cent should be rounded.
|
219
|
+
# @options options [Currency::CurrencyStruct,#to_s] :currency The currency
|
220
|
+
# representation the object should be created using.
|
193
221
|
#
|
194
222
|
# @raise [ArgumentError] Will raise an ArgumentError if as is not valid.
|
195
223
|
#
|
@@ -203,10 +231,13 @@ class Money
|
|
203
231
|
# Money.new(1.99, :as => :decimal) #=> #<Money:... @cents: 199>
|
204
232
|
def initialize(n = 0, options = {})
|
205
233
|
options = {
|
234
|
+
:currency => self.class.default_currency,
|
206
235
|
:rounding_method => self.class.default_rounding_method,
|
207
236
|
:as => self.class.default_as
|
208
237
|
}.merge(options)
|
209
238
|
|
239
|
+
@currency = Currency[options[:currency]]
|
240
|
+
|
210
241
|
raise ArgumentError, "invalid `rounding_method`" unless (
|
211
242
|
self.class.valid_rounding_method? options[:rounding_method]
|
212
243
|
)
|
@@ -222,10 +253,28 @@ class Money
|
|
222
253
|
BigDecimal(n.to_s), rounding_method
|
223
254
|
)
|
224
255
|
when :decimal
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
256
|
+
case currency.subunit_to_unit
|
257
|
+
when 10, 100, 1000
|
258
|
+
Money.round(
|
259
|
+
(
|
260
|
+
BigDecimal(n.to_s) *
|
261
|
+
BigDecimal(currency.subunit_to_unit.to_s)
|
262
|
+
),
|
263
|
+
rounding_method
|
264
|
+
)
|
265
|
+
when 1
|
266
|
+
Money.round(
|
267
|
+
BigDecimal(n.to_s), rounding_method
|
268
|
+
)
|
269
|
+
when 5
|
270
|
+
unit = BigDecimal(n.to_s).floor * BigDecimal("5")
|
271
|
+
subunit = (
|
272
|
+
(BigDecimal(n.to_s) % BigDecimal("1")) * BigDecimal("10")
|
273
|
+
)
|
274
|
+
Money.round(unit + subunit)
|
275
|
+
else
|
276
|
+
raise Exception, "creation of Money objects with subunit_to_unit = `#{currency.subunit_to_unit}` is not implmented"
|
277
|
+
end
|
229
278
|
end
|
230
279
|
end
|
231
280
|
|
@@ -243,6 +292,10 @@ class Money
|
|
243
292
|
# Money.new(1) + Money.new(2) #=> #<Money:... @cents: 3>
|
244
293
|
def +(n)
|
245
294
|
raise ArgumentError, "n must be a Money" unless n.is_a? Money
|
295
|
+
raise ArgumentError, "n is an incompatible currency" unless (
|
296
|
+
n.currency == currency
|
297
|
+
)
|
298
|
+
|
246
299
|
Money.new(self.cents + n.cents, :as => :cents)
|
247
300
|
end
|
248
301
|
|
@@ -260,6 +313,10 @@ class Money
|
|
260
313
|
# Money.new(2) - Money.new(1) #=> #<Money:... @cents: 1>
|
261
314
|
def -(n)
|
262
315
|
raise ArgumentError, "n must be a Money" unless n.is_a? Money
|
316
|
+
raise ArgumentError, "n is an incompatible currency" unless (
|
317
|
+
n.currency == currency
|
318
|
+
)
|
319
|
+
|
263
320
|
Money.new(self.cents - n.cents, :as => :cents)
|
264
321
|
end
|
265
322
|
|
@@ -302,6 +359,10 @@ class Money
|
|
302
359
|
def /(n)
|
303
360
|
case n
|
304
361
|
when Money
|
362
|
+
raise ArgumentError, "n is an incompatible currency" unless (
|
363
|
+
n.currency == currency
|
364
|
+
)
|
365
|
+
|
305
366
|
BigDecimal(self.cents.to_s) / BigDecimal(n.cents.to_s)
|
306
367
|
when Numeric
|
307
368
|
result, overflow = BigDecimal(self.cents.to_s).divmod(BigDecimal(n.to_s))
|
@@ -340,8 +401,15 @@ class Money
|
|
340
401
|
when :cents
|
341
402
|
cents.to_s
|
342
403
|
when :decimal
|
343
|
-
|
344
|
-
|
404
|
+
if currency.subunit_to_unit == 1
|
405
|
+
return cents.to_s
|
406
|
+
end
|
407
|
+
unit, subunit = cents.divmod(currency.subunit_to_unit).map(&:to_s)
|
408
|
+
subunit = (("0" * currency.decimal_places) + subunit)
|
409
|
+
subunit = subunit[
|
410
|
+
(-1 * currency.decimal_places),
|
411
|
+
currency.decimal_places
|
412
|
+
]
|
345
413
|
"#{unit}.#{subunit}"
|
346
414
|
end
|
347
415
|
end
|
metadata
CHANGED
@@ -3,48 +3,48 @@ name: simple_money
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
version: 0.
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
|
-
|
12
|
+
- Shane Emmons
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-11 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 2
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
version: 2.0.0
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: yard
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
48
|
description: This gem is intended for working with financial calculations where you need highly accurate results.
|
49
49
|
email: semmons99@gmail.com
|
50
50
|
executables: []
|
@@ -54,11 +54,12 @@ extensions: []
|
|
54
54
|
extra_rdoc_files: []
|
55
55
|
|
56
56
|
files:
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
- lib/simple_money/currency.rb
|
58
|
+
- lib/simple_money/money.rb
|
59
|
+
- lib/simple_money.rb
|
60
|
+
- CHANGELOG.md
|
61
|
+
- LICENSE
|
62
|
+
- README.md
|
62
63
|
has_rdoc: true
|
63
64
|
homepage: http://github.com/semmons99/simple_money
|
64
65
|
licenses: []
|
@@ -67,27 +68,27 @@ post_install_message:
|
|
67
68
|
rdoc_options: []
|
68
69
|
|
69
70
|
require_paths:
|
70
|
-
|
71
|
+
- lib
|
71
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
73
|
none: false
|
73
74
|
requirements:
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
segments:
|
78
|
+
- 1
|
79
|
+
- 8
|
80
|
+
- 7
|
81
|
+
version: 1.8.7
|
81
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
83
|
none: false
|
83
84
|
requirements:
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
segments:
|
88
|
+
- 1
|
89
|
+
- 3
|
90
|
+
- 7
|
91
|
+
version: 1.3.7
|
91
92
|
requirements: []
|
92
93
|
|
93
94
|
rubyforge_project:
|