cashish 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -74,7 +74,7 @@ module Cashish
74
74
  end
75
75
 
76
76
  def decimal_places
77
- currency_data[:e]
77
+ currency_data["e"]
78
78
  end
79
79
 
80
80
  def decimal_value
@@ -0,0 +1,1062 @@
1
+ AED:
2
+ num: 784
3
+ currency: United Arab Emirates dirham
4
+ e: 2
5
+ locations: "United Arab Emirates"
6
+
7
+ AFN:
8
+ num: 971
9
+ currency: Afghan afghani
10
+ e: 2
11
+ locations: "Afghanistan"
12
+
13
+ ALL:
14
+ num: 008
15
+ currency: Albanian lek
16
+ e: 2
17
+ locations: "Albania"
18
+
19
+ AMD:
20
+ num: 051
21
+ currency: Armenian dram
22
+ e: 2
23
+ locations: "Armenia"
24
+
25
+ ANG:
26
+ num: 532
27
+ currency: Netherlands Antillean guilder
28
+ e: 2
29
+ locations: "Curaao, Sint Maarten"
30
+
31
+ AOA:
32
+ num: 973
33
+ currency: Angolan kwanza
34
+ e: 2
35
+ locations: "Angola"
36
+
37
+ ARS:
38
+ num: 032
39
+ currency: Argentine peso
40
+ e: 2
41
+ locations: "Argentina"
42
+
43
+ AUD:
44
+ num: 036
45
+ currency: Australian dollar
46
+ e: 2
47
+ locations: "Australia, Australian Antarctic Territory, Christmas Island, Cocos (Keeling) Islands, Heard and McDonald Islands, Kiribati, Nauru, Norfolk Island, Tuvalu"
48
+
49
+ AWG:
50
+ num: 533
51
+ currency: Aruban florin
52
+ e: 2
53
+ locations: "Aruba"
54
+
55
+ AZN:
56
+ num: 944
57
+ currency: Azerbaijani manat
58
+ e: 2
59
+ locations: "Azerbaijan"
60
+
61
+ BAM:
62
+ num: 977
63
+ currency: Bosnia and Herzegovina convertible mark
64
+ e: 2
65
+ locations: "Bosnia and Herzegovina"
66
+
67
+ BBD:
68
+ num: 052
69
+ currency: Barbados dollar
70
+ e: 2
71
+ locations: "Barbados"
72
+
73
+ BDT:
74
+ num: 050
75
+ currency: Bangladeshi taka
76
+ e: 2
77
+ locations: "Bangladesh"
78
+
79
+ BGN:
80
+ num: 975
81
+ currency: Bulgarian lev
82
+ e: 2
83
+ locations: "Bulgaria"
84
+
85
+ BHD:
86
+ num: 048
87
+ currency: Bahraini dinar
88
+ e: 3
89
+ locations: "Bahrain"
90
+
91
+ BIF:
92
+ num: 108
93
+ currency: Burundian franc
94
+ e: 0
95
+ locations: "Burundi"
96
+
97
+ BMD:
98
+ num: 060
99
+ currency: Bermudian dollar (customarily known as Bermuda dollar)
100
+ e: 2
101
+ locations: "Bermuda"
102
+
103
+ BND:
104
+ num: 096
105
+ currency: Brunei dollar
106
+ e: 2
107
+ locations: "Brunei, Singapore"
108
+
109
+ BOB:
110
+ num: 068
111
+ currency: Boliviano
112
+ e: 2
113
+ locations: "Bolivia"
114
+
115
+ BOV:
116
+ num: 984
117
+ currency: Bolivian Mvdol (funds code)
118
+ e: 2
119
+ locations: "Bolivia"
120
+
121
+ BRL:
122
+ num: 986
123
+ currency: Brazilian real
124
+ e: 2
125
+ locations: "Brazil"
126
+
127
+ BSD:
128
+ num: 044
129
+ currency: Bahamian dollar
130
+ e: 2
131
+ locations: "Bahamas"
132
+
133
+ BTN:
134
+ num: 064
135
+ currency: Bhutanese ngultrum
136
+ e: 2
137
+ locations: "Bhutan"
138
+
139
+ BWP:
140
+ num: 072
141
+ currency: Botswana pula
142
+ e: 2
143
+ locations: "Botswana"
144
+
145
+ BYR:
146
+ num: 974
147
+ currency: Belarusian ruble
148
+ e: 0
149
+ locations: "Belarus"
150
+
151
+ BZD:
152
+ num: 084
153
+ currency: Belize dollar
154
+ e: 2
155
+ locations: "Belize"
156
+
157
+ CAD:
158
+ num: 124
159
+ currency: Canadian dollar
160
+ e: 2
161
+ locations: "Canada"
162
+
163
+ CDF:
164
+ num: 976
165
+ currency: Congolese franc
166
+ e: 2
167
+ locations: "Democratic Republic of Congo"
168
+
169
+ CHE:
170
+ num: 947
171
+ currency: WIR Bank (complementary currency)
172
+ e: 2
173
+ locations: "Switzerland"
174
+
175
+ CHF:
176
+ num: 756
177
+ currency: Swiss franc
178
+ e: 2
179
+ locations: "Switzerland, Liechtenstein"
180
+
181
+ CHW:
182
+ num: 948
183
+ currency: WIR Bank (complementary currency)
184
+ e: 2
185
+ locations: "Switzerland"
186
+
187
+ CLF:
188
+ num: 990
189
+ currency: Unidad de Fomento (funds code)
190
+ e: 0
191
+ locations: "Chile"
192
+
193
+ CLP:
194
+ num: 152
195
+ currency: Chilean peso
196
+ e: 0
197
+ locations: "Chile"
198
+
199
+ CNY:
200
+ num: 156
201
+ currency: Chinese yuan
202
+ e: 2
203
+ locations: "China (Mainland)"
204
+
205
+ COP:
206
+ num: 170
207
+ currency: Colombian peso
208
+ e: 2
209
+ locations: "Colombia"
210
+
211
+ COU:
212
+ num: 970
213
+ currency: Unidad de Valor Real
214
+ e: 2
215
+ locations: "Colombia"
216
+
217
+ CRC:
218
+ num: 188
219
+ currency: Costa Rican colon
220
+ e: 2
221
+ locations: "Costa Rica"
222
+
223
+ CUC:
224
+ num: 931
225
+ currency: Cuban convertible peso
226
+ e: 2
227
+ locations: "Cuba"
228
+
229
+ CUP:
230
+ num: 192
231
+ currency: Cuban peso
232
+ e: 2
233
+ locations: "Cuba"
234
+
235
+ CVE:
236
+ num: 132
237
+ currency: Cape Verde escudo
238
+ e: 0
239
+ locations: "Cape Verde"
240
+
241
+ CZK:
242
+ num: 203
243
+ currency: Czech koruna
244
+ e: 2
245
+ locations: "Czech Republic"
246
+
247
+ DJF:
248
+ num: 262
249
+ currency: Djiboutian franc
250
+ e: 0
251
+ locations: "Djibouti"
252
+
253
+ DKK:
254
+ num: 208
255
+ currency: Danish krone
256
+ e: 2
257
+ locations: "Denmark, Faroe Islands, Greenland"
258
+
259
+ DOP:
260
+ num: 214
261
+ currency: Dominican peso
262
+ e: 2
263
+ locations: "Dominican Republic"
264
+
265
+ DZD:
266
+ num: 012
267
+ currency: Algerian dinar
268
+ e: 2
269
+ locations: "Algeria"
270
+
271
+ EGP:
272
+ num: 818
273
+ currency: Egyptian pound
274
+ e: 2
275
+ locations: "Egypt"
276
+
277
+ ERN:
278
+ num: 232
279
+ currency: Eritrean nakfa
280
+ e: 2
281
+ locations: "Eritrea"
282
+
283
+ ETB:
284
+ num: 230
285
+ currency: Ethiopian birr
286
+ e: 2
287
+ locations: "Ethiopia"
288
+
289
+ EUR:
290
+ num: 978
291
+ currency: Euro
292
+ e: 2
293
+ locations: "17 European Union countries, Andorra, Kosovo, Monaco, Montenegro, San Marino, Vatican City; see eurozone"
294
+
295
+ FJD:
296
+ num: 242
297
+ currency: Fiji dollar
298
+ e: 2
299
+ locations: "Fiji"
300
+
301
+ FKP:
302
+ num: 238
303
+ currency: Falkland Islands pound
304
+ e: 2
305
+ locations: "Falkland Islands"
306
+
307
+ GBP:
308
+ num: 826
309
+ currency: Pound sterling
310
+ e: 2
311
+ locations: "United Kingdom, Crown Dependencies (the Isle of Man and the Channel Islands), certain British Overseas Territories (South Georgia and the South Sandwich Islands, British Antarctic Territory and British Indian Ocean Territory)"
312
+
313
+ GEL:
314
+ num: 981
315
+ currency: Georgian lari
316
+ e: 2
317
+ locations: "Georgia"
318
+
319
+ GHS:
320
+ num: 936
321
+ currency: Ghanaian cedi
322
+ e: 2
323
+ locations: "Ghana"
324
+
325
+ GIP:
326
+ num: 292
327
+ currency: Gibraltar pound
328
+ e: 2
329
+ locations: "Gibraltar"
330
+
331
+ GMD:
332
+ num: 270
333
+ currency: Gambian dalasi
334
+ e: 2
335
+ locations: "Gambia"
336
+
337
+ GNF:
338
+ num: 324
339
+ currency: Guinean franc
340
+ e: 0
341
+ locations: "Guinea"
342
+
343
+ GTQ:
344
+ num: 320
345
+ currency: Guatemalan quetzal
346
+ e: 2
347
+ locations: "Guatemala"
348
+
349
+ GYD:
350
+ num: 328
351
+ currency: Guyanese dollar
352
+ e: 2
353
+ locations: "Guyana"
354
+
355
+ HKD:
356
+ num: 344
357
+ currency: Hong Kong dollar
358
+ e: 2
359
+ locations: "Hong Kong Special Administrative Region, Macau Special Administrative Region"
360
+
361
+ HNL:
362
+ num: 340
363
+ currency: Honduran lempira
364
+ e: 2
365
+ locations: "Honduras"
366
+
367
+ HRK:
368
+ num: 191
369
+ currency: Croatian kuna
370
+ e: 2
371
+ locations: "Croatia"
372
+
373
+ HTG:
374
+ num: 332
375
+ currency: Haitian gourde
376
+ e: 2
377
+ locations: "Haiti"
378
+
379
+ HUF:
380
+ num: 348
381
+ currency: Hungarian forint
382
+ e: 2
383
+ locations: "Hungary"
384
+
385
+ IDR:
386
+ num: 360
387
+ currency: Indonesian rupiah
388
+ e: 0
389
+ locations: "Indonesia"
390
+
391
+ ILS:
392
+ num: 376
393
+ currency: Israeli new sheqel
394
+ e: 2
395
+ locations: "Israel"
396
+
397
+ INR:
398
+ num: 356
399
+ currency: Indian rupee
400
+ e: 2
401
+ locations: "Bhutan, India"
402
+
403
+ IQD:
404
+ num: 368
405
+ currency: Iraqi dinar
406
+ e: 0
407
+ locations: "Iraq"
408
+
409
+ IRR:
410
+ num: 364
411
+ currency: Iranian rial
412
+ e: 0
413
+ locations: "Iran"
414
+
415
+ ISK:
416
+ num: 352
417
+ currency: Icelandic krna
418
+ e: 0
419
+ locations: "Iceland"
420
+
421
+ JMD:
422
+ num: 388
423
+ currency: Jamaican dollar
424
+ e: 2
425
+ locations: "Jamaica"
426
+
427
+ JOD:
428
+ num: 400
429
+ currency: Jordanian dinar
430
+ e: 3
431
+ locations: "Jordan"
432
+
433
+ JPY:
434
+ num: 392
435
+ currency: Japanese yen
436
+ e: 0
437
+ locations: "Japan"
438
+
439
+ KES:
440
+ num: 404
441
+ currency: Kenyan shilling
442
+ e: 2
443
+ locations: "Kenya"
444
+
445
+ KGS:
446
+ num: 417
447
+ currency: Kyrgyzstani som
448
+ e: 2
449
+ locations: "Kyrgyzstan"
450
+
451
+ KHR:
452
+ num: 116
453
+ currency: Cambodian riel
454
+ e: 2
455
+ locations: "Cambodia"
456
+
457
+ KMF:
458
+ num: 174
459
+ currency: Comoro franc
460
+ e: 0
461
+ locations: "Comoros"
462
+
463
+ KPW:
464
+ num: 408
465
+ currency: North Korean won
466
+ e: 0
467
+ locations: "North Korea"
468
+
469
+ KRW:
470
+ num: 410
471
+ currency: South Korean won
472
+ e: 0
473
+ locations: "South Korea"
474
+
475
+ KWD:
476
+ num: 414
477
+ currency: Kuwaiti dinar
478
+ e: 3
479
+ locations: "Kuwait"
480
+
481
+ KYD:
482
+ num: 136
483
+ currency: Cayman Islands dollar
484
+ e: 2
485
+ locations: "Cayman Islands"
486
+
487
+ KZT:
488
+ num: 398
489
+ currency: Kazakhstani tenge
490
+ e: 2
491
+ locations: "Kazakhstan"
492
+
493
+ LAK:
494
+ num: 418
495
+ currency: Lao kip
496
+ e: 0
497
+ locations: "Laos"
498
+
499
+ LBP:
500
+ num: 422
501
+ currency: Lebanese pound
502
+ e: 0
503
+ locations: "Lebanon"
504
+
505
+ LKR:
506
+ num: 144
507
+ currency: Sri Lanka rupee
508
+ e: 2
509
+ locations: "Sri Lanka"
510
+
511
+ LRD:
512
+ num: 430
513
+ currency: Liberian dollar
514
+ e: 2
515
+ locations: "Liberia"
516
+
517
+ LSL:
518
+ num: 426
519
+ currency: Lesotho loti
520
+ e: 2
521
+ locations: "Lesotho"
522
+
523
+ LTL:
524
+ num: 440
525
+ currency: Lithuanian litas
526
+ e: 2
527
+ locations: "Lithuania"
528
+
529
+ LVL:
530
+ num: 428
531
+ currency: Latvian lats
532
+ e: 2
533
+ locations: "Latvia"
534
+
535
+ LYD:
536
+ num: 434
537
+ currency: Libyan dinar
538
+ e: 3
539
+ locations: "Libya"
540
+
541
+ MAD:
542
+ num: 504
543
+ currency: Moroccan dirham
544
+ e: 2
545
+ locations: "Morocco, Western Sahara"
546
+
547
+ MDL:
548
+ num: 498
549
+ currency: Moldovan leu
550
+ e: 2
551
+ locations: "Moldova (except Transnistria)"
552
+
553
+ MGA:
554
+ num: 969
555
+ currency: Malagasy ariary
556
+ e: 0.69897
557
+ locations: "Madagascar"
558
+
559
+ MKD:
560
+ num: 807
561
+ currency: Macedonian denar
562
+ e: 2
563
+ locations: "Republic of Macedonia"
564
+
565
+ MMK:
566
+ num: 104
567
+ currency: Myanma kyat
568
+ e: 0
569
+ locations: "Myanmar"
570
+
571
+ MNT:
572
+ num: 496
573
+ currency: Mongolian tugrik
574
+ e: 2
575
+ locations: "Mongolia"
576
+
577
+ MOP:
578
+ num: 446
579
+ currency: Macanese pataca
580
+ e: 1
581
+ locations: "Macau Special Administrative Region"
582
+
583
+ MRO:
584
+ num: 478
585
+ currency: Mauritanian ouguiya
586
+ e: 0.69897
587
+ locations: "Mauritania"
588
+
589
+ MUR:
590
+ num: 480
591
+ currency: Mauritian rupee
592
+ e: 2
593
+ locations: "Mauritius"
594
+
595
+ MVR:
596
+ num: 462
597
+ currency: Maldivian rufiyaa
598
+ e: 2
599
+ locations: "Maldives"
600
+
601
+ MWK:
602
+ num: 454
603
+ currency: Malawian kwacha
604
+ e: 2
605
+ locations: "Malawi"
606
+
607
+ MXN:
608
+ num: 484
609
+ currency: Mexican peso
610
+ e: 2
611
+ locations: "Mexico"
612
+
613
+ MXV:
614
+ num: 979
615
+ currency: Mexican Unidad de Inversion (UDI) (funds code)
616
+ e: 2
617
+ locations: "Mexico"
618
+
619
+ MYR:
620
+ num: 458
621
+ currency: Malaysian ringgit
622
+ e: 2
623
+ locations: "Malaysia"
624
+
625
+ MZN:
626
+ num: 943
627
+ currency: Mozambican metical
628
+ e: 2
629
+ locations: "Mozambique"
630
+
631
+ NAD:
632
+ num: 516
633
+ currency: Namibian dollar
634
+ e: 2
635
+ locations: "Namibia"
636
+
637
+ NGN:
638
+ num: 566
639
+ currency: Nigerian naira
640
+ e: 2
641
+ locations: "Nigeria"
642
+
643
+ NIO:
644
+ num: 558
645
+ currency: Cordoba oro
646
+ e: 2
647
+ locations: "Nicaragua"
648
+
649
+ NOK:
650
+ num: 578
651
+ currency: Norwegian krone
652
+ e: 2
653
+ locations: "Norway, Svalbard, Jan Mayen, Bouvet Island, Queen Maud Land, Peter I Island"
654
+
655
+ NPR:
656
+ num: 524
657
+ currency: Nepalese rupee
658
+ e: 2
659
+ locations: "Nepal"
660
+
661
+ NZD:
662
+ num: 554
663
+ currency: New Zealand dollar
664
+ e: 2
665
+ locations: "Cook Islands, New Zealand, Niue, Pitcairn, Tokelau"
666
+
667
+ OMR:
668
+ num: 512
669
+ currency: Omani rial
670
+ e: 3
671
+ locations: "Oman"
672
+
673
+ PAB:
674
+ num: 590
675
+ currency: Panamanian balboa
676
+ e: 2
677
+ locations: "Panama"
678
+
679
+ PEN:
680
+ num: 604
681
+ currency: Peruvian nuevo sol
682
+ e: 2
683
+ locations: "Peru"
684
+
685
+ PGK:
686
+ num: 598
687
+ currency: Papua New Guinean kina
688
+ e: 2
689
+ locations: "Papua New Guinea"
690
+
691
+ PHP:
692
+ num: 608
693
+ currency: Philippine peso
694
+ e: 2
695
+ locations: "Philippines"
696
+
697
+ PKR:
698
+ num: 586
699
+ currency: Pakistani rupee
700
+ e: 2
701
+ locations: "Pakistan"
702
+
703
+ PLN:
704
+ num: 985
705
+ currency: Polish zoty
706
+ e: 2
707
+ locations: "Poland"
708
+
709
+ PYG:
710
+ num: 600
711
+ currency: Paraguayan guaran
712
+ e: 0
713
+ locations: "Paraguay"
714
+
715
+ QAR:
716
+ num: 634
717
+ currency: Qatari rial
718
+ e: 2
719
+ locations: "Qatar"
720
+
721
+ RON:
722
+ num: 946
723
+ currency: Romanian new leu
724
+ e: 2
725
+ locations: "Romania"
726
+
727
+ RSD:
728
+ num: 941
729
+ currency: Serbian dinar
730
+ e: 2
731
+ locations: "Serbia"
732
+
733
+ RUB:
734
+ num: 643
735
+ currency: Russian rouble
736
+ e: 2
737
+ locations: "Russia, Abkhazia, South Ossetia"
738
+
739
+ RWF:
740
+ num: 646
741
+ currency: Rwandan franc
742
+ e: 0
743
+ locations: "Rwanda"
744
+
745
+ SAR:
746
+ num: 682
747
+ currency: Saudi riyal
748
+ e: 2
749
+ locations: "Saudi Arabia"
750
+
751
+ SBD:
752
+ num: 090
753
+ currency: Solomon Islands dollar
754
+ e: 2
755
+ locations: "Solomon Islands"
756
+
757
+ SCR:
758
+ num: 690
759
+ currency: Seychelles rupee
760
+ e: 2
761
+ locations: "Seychelles"
762
+
763
+ SDG:
764
+ num: 938
765
+ currency: Sudanese pound
766
+ e: 2
767
+ locations: "Sudan"
768
+
769
+ SEK:
770
+ num: 752
771
+ currency: Swedish krona/kronor
772
+ e: 2
773
+ locations: "Sweden"
774
+
775
+ SGD:
776
+ num: 702
777
+ currency: Singapore dollar
778
+ e: 2
779
+ locations: "Singapore, Brunei"
780
+
781
+ SHP:
782
+ num: 654
783
+ currency: Saint Helena pound
784
+ e: 2
785
+ locations: "Saint Helena"
786
+
787
+ SLL:
788
+ num: 694
789
+ currency: Sierra Leonean leone
790
+ e: 0
791
+ locations: "Sierra Leone"
792
+
793
+ SOS:
794
+ num: 706
795
+ currency: Somali shilling
796
+ e: 2
797
+ locations: "Somalia (except Somaliland)"
798
+
799
+ SRD:
800
+ num: 968
801
+ currency: Surinamese dollar
802
+ e: 2
803
+ locations: "Suriname"
804
+
805
+ STD:
806
+ num: 678
807
+ currency: So Tom and Prncipe dobra
808
+ e: 0
809
+ locations: "So Tom and Prncipe"
810
+
811
+ SYP:
812
+ num: 760
813
+ currency: Syrian pound
814
+ e: 2
815
+ locations: "Syria"
816
+
817
+ SZL:
818
+ num: 748
819
+ currency: Lilangeni
820
+ e: 2
821
+ locations: "Swaziland"
822
+
823
+ THB:
824
+ num: 764
825
+ currency: Thai baht
826
+ e: 2
827
+ locations: "Thailand"
828
+
829
+ TJS:
830
+ num: 972
831
+ currency: Tajikistani somoni
832
+ e: 2
833
+ locations: "Tajikistan"
834
+
835
+ TMT:
836
+ num: 934
837
+ currency: Turkmenistani manat
838
+ e: 2
839
+ locations: "Turkmenistan"
840
+
841
+ TND:
842
+ num: 788
843
+ currency: Tunisian dinar
844
+ e: 3
845
+ locations: "Tunisia"
846
+
847
+ TOP:
848
+ num: 776
849
+ currency: Tongan paanga
850
+ e: 2
851
+ locations: "Tonga"
852
+
853
+ TRY:
854
+ num: 949
855
+ currency: Turkish lira
856
+ e: 2
857
+ locations: "Turkey, Northern Cyprus"
858
+
859
+ TTD:
860
+ num: 780
861
+ currency: Trinidad and Tobago dollar
862
+ e: 2
863
+ locations: "Trinidad and Tobago"
864
+
865
+ TWD:
866
+ num: 901
867
+ currency: New Taiwan dollar
868
+ e: 2
869
+ locations: "Taiwan and other islands that are under the effective control of the Republic of China (ROC)"
870
+
871
+ TZS:
872
+ num: 834
873
+ currency: Tanzanian shilling
874
+ e: 2
875
+ locations: "Tanzania"
876
+
877
+ UAH:
878
+ num: 980
879
+ currency: Ukrainian hryvnia
880
+ e: 2
881
+ locations: "Ukraine"
882
+
883
+ UGX:
884
+ num: 800
885
+ currency: Ugandan shilling
886
+ e: 0
887
+ locations: "Uganda"
888
+
889
+ USD:
890
+ num: 840
891
+ currency: United States dollar
892
+ e: 2
893
+ locations: "American Samoa, British Indian Ocean Territory, Caribbean Netherlands, Ecuador, El Salvador, Guam, Haiti, Marshall Islands, Micronesia, Northern Mariana Islands, Palau, Panama, Puerto Rico, Timor-Leste, Turks and Caicos Islands, United States, Virgin Islands, Bermuda (as well as Bermudian Dollar)"
894
+
895
+ USN:
896
+ num: 997
897
+ currency: United States dollar (next day) (funds code)
898
+ e: 2
899
+ locations: "United States"
900
+
901
+ USS:
902
+ num: 998
903
+ currency: United States dollar (same day) (funds code) (one source[who?] claims it is no longer used, but it is still on the ISO 4217-MA list)
904
+ e: 2
905
+ locations: "United States"
906
+
907
+ UYU:
908
+ num: 858
909
+ currency: Uruguayan peso
910
+ e: 2
911
+ locations: "Uruguay"
912
+
913
+ UZS:
914
+ num: 860
915
+ currency: Uzbekistan som
916
+ e: 2
917
+ locations: "Uzbekistan"
918
+
919
+ VEF:
920
+ num: 937
921
+ currency: Venezuelan bolvar fuerte
922
+ e: 2
923
+ locations: "Venezuela"
924
+
925
+ VND:
926
+ num: 704
927
+ currency: Vietnamese ng
928
+ e: 0
929
+ locations: "Vietnam"
930
+
931
+ VUV:
932
+ num: 548
933
+ currency: Vanuatu vatu
934
+ e: 0
935
+ locations: "Vanuatu"
936
+
937
+ WST:
938
+ num: 882
939
+ currency: Samoan tala
940
+ e: 2
941
+ locations: "Samoa"
942
+
943
+ XAF:
944
+ num: 950
945
+ currency: CFA franc BEAC
946
+ e: 0
947
+ locations: "Cameroon, Central African Republic, Republic of the Congo, Chad, Equatorial Guinea, Gabon"
948
+
949
+ XAG:
950
+ num: 961
951
+ currency: Silver (one troy ounce)
952
+ e: .
953
+ locations: ""
954
+
955
+ XAU:
956
+ num: 959
957
+ currency: Gold (one troy ounce)
958
+ e: .
959
+ locations: ""
960
+
961
+ XBA:
962
+ num: 955
963
+ currency: European Composite Unit (EURCO) (bond market unit)
964
+ e: .
965
+ locations: ""
966
+
967
+ XBB:
968
+ num: 956
969
+ currency: European Monetary Unit (E.M.U.-6) (bond market unit)
970
+ e: .
971
+ locations: ""
972
+
973
+ XBC:
974
+ num: 957
975
+ currency: European Unit of Account 9 (E.U.A.-9) (bond market unit)
976
+ e: .
977
+ locations: ""
978
+
979
+ XBD:
980
+ num: 958
981
+ currency: European Unit of Account 17 (E.U.A.-17) (bond market unit)
982
+ e: .
983
+ locations: ""
984
+
985
+ XCD:
986
+ num: 951
987
+ currency: East Caribbean dollar
988
+ e: 2
989
+ locations: "Anguilla, Antigua and Barbuda, Dominica, Grenada, Montserrat, Saint Kitts and Nevis, Saint Lucia, Saint Vincent and the Grenadines"
990
+
991
+ XDR:
992
+ num: 960
993
+ currency: Special Drawing Rights
994
+ e: .
995
+ locations: "International Monetary Fund"
996
+
997
+ XFU:
998
+ num: Nil
999
+ currency: UIC franc (special settlement currency)
1000
+ e: .
1001
+ locations: "International Union of Railways"
1002
+
1003
+ XOF:
1004
+ num: 952
1005
+ currency: CFA Franc BCEAO
1006
+ e: 0
1007
+ locations: "Benin, Burkina Faso, Cte d'Ivoire, Guinea-Bissau, Mali, Niger, Senegal, Togo"
1008
+
1009
+ XPD:
1010
+ num: 964
1011
+ currency: Palladium (one troy ounce)
1012
+ e: .
1013
+ locations: ""
1014
+
1015
+ XPF:
1016
+ num: 953
1017
+ currency: CFP franc
1018
+ e: 0
1019
+ locations: "French Polynesia, New Caledonia, Wallis and Futuna"
1020
+
1021
+ XPT:
1022
+ num: 962
1023
+ currency: Platinum (one troy ounce)
1024
+ e: .
1025
+ locations: ""
1026
+
1027
+ XTS:
1028
+ num: 963
1029
+ currency: Code reserved for testing purposes
1030
+ e: .
1031
+ locations: ""
1032
+
1033
+ XXX:
1034
+ num: 999
1035
+ currency: No currency
1036
+ e: .
1037
+ locations: ""
1038
+
1039
+ YER:
1040
+ num: 886
1041
+ currency: Yemeni rial
1042
+ e: 0
1043
+ locations: "Yemen"
1044
+
1045
+ ZAR:
1046
+ num: 710
1047
+ currency: South African rand
1048
+ e: 2
1049
+ locations: "South Africa"
1050
+
1051
+ ZMK:
1052
+ num: 894
1053
+ currency: Zambian kwacha
1054
+ e: 0
1055
+ locations: "Zambia"
1056
+
1057
+ ZWL:
1058
+ num: 932
1059
+ currency: Zimbabwe dollar
1060
+ e: 2
1061
+ locations: "Zimbabwe"
1062
+
@@ -7,24 +7,29 @@ module Cashish
7
7
  # http://en.wikipedia.org/wiki/ISO_4217
8
8
  # Code | Num | E | Currency | Locations using this currency
9
9
  # HKD | 344 | 2 | Hong Kong dollar | Hong Kong Special Administrative Region
10
- CURRENCIES = [
11
- {:code => "HKD", :num => 344, :e => 2, :currency => "Hong Kong dollar", :locations => "Hong Kong Special Administrative Region"},
12
- {:code => "SGD", :num => 702, :e => 2, :currency => "Singapore dollar", :locations => "Singapore"}
13
- ]
10
+ CURRENCIES = YAML.load(File.read(File.dirname(__FILE__)+"/currencies.yml"))
14
11
 
15
12
  class << self
16
13
 
17
14
  extend ActiveSupport::Memoizable
18
15
 
19
16
  def find_by_code(code)
20
- CURRENCIES.detect{|currency| currency[:code] == code} || raise(MissingCurrencyException, "no currency #{code}")
17
+ if currency = CURRENCIES[code]
18
+ if currency["e"].is_a?(Fixnum)
19
+ currency
20
+ else
21
+ raise "I don't know how to handle this currency #{code} with e=#{currency["e"]}"
22
+ end
23
+ else
24
+ raise(MissingCurrencyException, "no currency #{code}")
25
+ end
21
26
  end
22
27
  memoize :find_by_code
23
28
 
24
29
  alias :[] :find_by_code
25
30
 
26
31
  def codes
27
- CURRENCIES.map{|currency| currency[:code]}
32
+ CURRENCIES.keys
28
33
  end
29
34
  end
30
35
 
@@ -4,7 +4,7 @@ class CurrencyTest < Test::Unit::TestCase
4
4
 
5
5
  test "Currency['HKD'] grabs all the data for HKDs" do
6
6
  assert_equal(
7
- {:code => "HKD", :num => 344, :e => 2, :currency => "Hong Kong dollar", :locations => "Hong Kong Special Administrative Region"},
7
+ {"num" => 344, "e" => 2, "currency" => "Hong Kong dollar", "locations" => "Hong Kong Special Administrative Region, Macau Special Administrative Region"},
8
8
  Cashish::Currency["HKD"])
9
9
  end
10
10
 
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+
3
+ class EdgeCasesTest < Test::Unit::TestCase
4
+
5
+ test "3 digits" do
6
+ amount = Cashish::Amount.new(123_456_789, "JOD")
7
+ assert_equal "123,456.789 JOD", amount.to_s
8
+ end
9
+
10
+ test "0 digits" do
11
+ amount = Cashish::Amount.new(123_456_789, "KRW")
12
+ assert_equal "123,456,789 KRW", amount.to_s
13
+ end
14
+
15
+ test "0.69897 digits" do
16
+ assert_raise(RuntimeError) do
17
+ Cashish::Amount.new(123_456_789, "MGA")
18
+ end
19
+ end
20
+
21
+ test "gold" do
22
+ assert_raise(RuntimeError) do
23
+ Cashish::Amount.new(123_456_789, "XAU")
24
+ end
25
+ end
26
+
27
+ end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cashish
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
- - Matthew Rudy Jacobs
13
+ - Thought Sauce
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
@@ -46,7 +46,7 @@ dependencies:
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  description:
49
- email: MatthewRudyJacobs@gmail.com
49
+ email: hello@thought-sauce.com
50
50
  executables: []
51
51
 
52
52
  extensions: []
@@ -58,12 +58,14 @@ files:
58
58
  - test/arithmetic_test.rb
59
59
  - test/currency_test.rb
60
60
  - test/display_test.rb
61
+ - test/edge_cases_test.rb
61
62
  - test/test_helper.rb
62
63
  - lib/cashish/amount.rb
64
+ - lib/cashish/currencies.yml
63
65
  - lib/cashish/currency.rb
64
66
  - lib/cashish.rb
65
67
  - README
66
- homepage: https://github.com/matthewrudy/cashish
68
+ homepage: https://github.com/thought-sauce/cashish
67
69
  licenses: []
68
70
 
69
71
  post_install_message: