minting 1.6.3 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/Rakefile +13 -3
- data/doc/Mint/Currency.html +993 -0
- data/doc/Mint/CurrencyRegistry.html +511 -0
- data/doc/Mint/Money.html +3856 -0
- data/doc/Mint/UnknownCurrency.html +136 -0
- data/doc/Mint.html +886 -0
- data/doc/Minting.html +142 -0
- data/doc/_index.html +158 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +206 -0
- data/doc/css/style.css +1089 -0
- data/doc/file.README.html +278 -0
- data/doc/file_list.html +59 -0
- data/doc/frames.html +22 -0
- data/doc/index.html +278 -0
- data/doc/js/app.js +801 -0
- data/doc/js/full_list.js +334 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +510 -0
- data/doc/top-level-namespace.html +143 -0
- data/lib/minting/mint/currency/currency_registry.rb +1 -1
- data/lib/minting/mint/dsl/range.rb +54 -0
- data/lib/minting/mint/{dsl.rb → dsl/refinements.rb} +0 -10
- data/lib/minting/mint/dsl/top_level.rb +14 -0
- data/lib/minting/mint/mint.rb +2 -2
- data/lib/minting/mint/parser.rb +16 -9
- data/lib/minting/mint.rb +3 -1
- data/lib/minting/money/allocation.rb +14 -14
- data/lib/minting/money/arithmetics.rb +5 -5
- data/lib/minting/money/coercion.rb +8 -11
- data/lib/minting/money/formatting.rb +23 -28
- data/lib/minting/version.rb +1 -1
- data/minting.gemspec +5 -2
- metadata +31 -5
|
@@ -0,0 +1,993 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Class: Mint::Currency
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.44
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css">
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css">
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript">
|
|
18
|
+
pathId = "Mint::Currency";
|
|
19
|
+
relpath = '../';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div id="main_progress" aria-hidden="true"></div>
|
|
31
|
+
|
|
32
|
+
<div class="nav_wrap">
|
|
33
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
|
34
|
+
<div id="resizer"></div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div id="main" tabindex="-1">
|
|
38
|
+
<div id="header">
|
|
39
|
+
<div id="menu">
|
|
40
|
+
|
|
41
|
+
<a href="../_index.html">Index (C)</a> »
|
|
42
|
+
<span class='title'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span>
|
|
43
|
+
»
|
|
44
|
+
<span class="title">Currency</span>
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div id="search">
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="class_list_link"
|
|
51
|
+
href="../class_list.html">
|
|
52
|
+
|
|
53
|
+
<svg width="24" height="24">
|
|
54
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
56
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
57
|
+
</svg>
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div id="content"><h1>Class: Mint::Currency
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
</h1>
|
|
69
|
+
<div class="box_info">
|
|
70
|
+
|
|
71
|
+
<dl>
|
|
72
|
+
<dt>Inherits:</dt>
|
|
73
|
+
<dd>
|
|
74
|
+
<span class="inheritName">Data</span>
|
|
75
|
+
|
|
76
|
+
<ul class="fullTree">
|
|
77
|
+
<li>Object</li>
|
|
78
|
+
|
|
79
|
+
<li class="next">Data</li>
|
|
80
|
+
|
|
81
|
+
<li class="next">Mint::Currency</li>
|
|
82
|
+
|
|
83
|
+
</ul>
|
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
85
|
+
|
|
86
|
+
</dd>
|
|
87
|
+
</dl>
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<dl>
|
|
100
|
+
<dt>Defined in:</dt>
|
|
101
|
+
<dd>lib/minting/mint/currency/currency.rb
|
|
102
|
+
</dd>
|
|
103
|
+
</dl>
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
|
108
|
+
<div class="discussion">
|
|
109
|
+
<p>Represents a specific currency unit, identified by ISO 4217 alphabetic code.
|
|
110
|
+
Currency objects are immutable and define the properties of a monetary unit
|
|
111
|
+
including its subunit precision, display symbol, and formatting rules.</p>
|
|
112
|
+
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="tags">
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
<p class="tag_title">See Also:</p>
|
|
119
|
+
<ul class="see">
|
|
120
|
+
|
|
121
|
+
<li><a href="https://www.iso.org/iso-4217-currency-codes.html" target="_parent" title="https://www.iso.org/iso-4217-currency-codes.html">https://www.iso.org/iso-4217-currency-codes.html</a></li>
|
|
122
|
+
|
|
123
|
+
</ul>
|
|
124
|
+
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
130
|
+
<ul class="summary">
|
|
131
|
+
|
|
132
|
+
<li class="public ">
|
|
133
|
+
<span class="summary_signature">
|
|
134
|
+
|
|
135
|
+
<a href="#code-instance_method" title="#code (instance method)">#<strong>code</strong> ⇒ String </a>
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
</span>
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
<span class="note title readonly">readonly</span>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
<span class="summary_desc"><div class='inline'><p>ISO 4217 currency code (e.g., "USD", "EUR").</p></div></span>
|
|
155
|
+
|
|
156
|
+
</li>
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
<li class="public ">
|
|
160
|
+
<span class="summary_signature">
|
|
161
|
+
|
|
162
|
+
<a href="#country-instance_method" title="#country (instance method)">#<strong>country</strong> ⇒ String<sup>?</sup> </a>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
</span>
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
<span class="note title readonly">readonly</span>
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
<span class="summary_desc"><div class='inline'><p>Associated country code.</p></div></span>
|
|
182
|
+
|
|
183
|
+
</li>
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
<li class="public ">
|
|
187
|
+
<span class="summary_signature">
|
|
188
|
+
|
|
189
|
+
<a href="#fractional_multiplier-instance_method" title="#fractional_multiplier (instance method)">#<strong>fractional_multiplier</strong> ⇒ Integer </a>
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
</span>
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
<span class="note title readonly">readonly</span>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
<span class="summary_desc"><div class='inline'><p>10^subunit, used for fractional conversions.</p></div></span>
|
|
209
|
+
|
|
210
|
+
</li>
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
<li class="public ">
|
|
214
|
+
<span class="summary_signature">
|
|
215
|
+
|
|
216
|
+
<a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> ⇒ String<sup>?</sup> </a>
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
</span>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
<span class="note title readonly">readonly</span>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
<span class="summary_desc"><div class='inline'><p>Currency name.</p></div></span>
|
|
236
|
+
|
|
237
|
+
</li>
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
<li class="public ">
|
|
241
|
+
<span class="summary_signature">
|
|
242
|
+
|
|
243
|
+
<a href="#priority-instance_method" title="#priority (instance method)">#<strong>priority</strong> ⇒ Integer </a>
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
</span>
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
<span class="note title readonly">readonly</span>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
<span class="summary_desc"><div class='inline'><p>Parser precedence for symbol detection.</p></div></span>
|
|
263
|
+
|
|
264
|
+
</li>
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
<li class="public ">
|
|
268
|
+
<span class="summary_signature">
|
|
269
|
+
|
|
270
|
+
<a href="#subunit-instance_method" title="#subunit (instance method)">#<strong>subunit</strong> ⇒ Integer </a>
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
</span>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
<span class="note title readonly">readonly</span>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
<span class="summary_desc"><div class='inline'><p>Number of decimal places (0 for JPY, 2 for USD, 3 for IQD).</p></div></span>
|
|
290
|
+
|
|
291
|
+
</li>
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
<li class="public ">
|
|
295
|
+
<span class="summary_signature">
|
|
296
|
+
|
|
297
|
+
<a href="#symbol-instance_method" title="#symbol (instance method)">#<strong>symbol</strong> ⇒ String </a>
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
</span>
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
<span class="note title readonly">readonly</span>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
<span class="summary_desc"><div class='inline'><p>Display symbol (e.g., "$", "€", "R$").</p></div></span>
|
|
317
|
+
|
|
318
|
+
</li>
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
</ul>
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
<h2>
|
|
328
|
+
Instance Method Summary
|
|
329
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
330
|
+
</h2>
|
|
331
|
+
|
|
332
|
+
<ul class="summary">
|
|
333
|
+
|
|
334
|
+
<li class="public ">
|
|
335
|
+
<span class="summary_signature">
|
|
336
|
+
|
|
337
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(code:, symbol:, subunit: 0, priority: 0, country: nil, name: nil) ⇒ Currency </a>
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
</span>
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
<span class="note title constructor">constructor</span>
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of Currency.</p></div></span>
|
|
354
|
+
|
|
355
|
+
</li>
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
<li class="public ">
|
|
359
|
+
<span class="summary_signature">
|
|
360
|
+
|
|
361
|
+
<a href="#inspect-instance_method" title="#inspect (instance method)">#<strong>inspect</strong> ⇒ Object </a>
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
</span>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
376
|
+
|
|
377
|
+
</li>
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
<li class="public ">
|
|
381
|
+
<span class="summary_signature">
|
|
382
|
+
|
|
383
|
+
<a href="#minimum_amount-instance_method" title="#minimum_amount (instance method)">#<strong>minimum_amount</strong> ⇒ Object </a>
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
</span>
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
398
|
+
|
|
399
|
+
</li>
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
<li class="public ">
|
|
403
|
+
<span class="summary_signature">
|
|
404
|
+
|
|
405
|
+
<a href="#normalize_amount-instance_method" title="#normalize_amount (instance method)">#<strong>normalize_amount</strong>(amount) ⇒ Object </a>
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
</span>
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
<span class="summary_desc"><div class='inline'><p>Normalizes numeric amounts for this currency 1.</p></div></span>
|
|
420
|
+
|
|
421
|
+
</li>
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
</ul>
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
<div id="constructor_details" class="method_details_list">
|
|
430
|
+
<h2>Constructor Details</h2>
|
|
431
|
+
|
|
432
|
+
<div class="method_details first">
|
|
433
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
434
|
+
|
|
435
|
+
#<strong>initialize</strong>(code:, symbol:, subunit: 0, priority: 0, country: nil, name: nil) ⇒ <tt><span class='object_link'><a href="" title="Mint::Currency (class)">Currency</a></span></tt>
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
</h3><div class="docstring">
|
|
442
|
+
<div class="discussion">
|
|
443
|
+
<p>Returns a new instance of Currency.</p>
|
|
444
|
+
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
<div class="tags">
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
</div><table class="source_code">
|
|
451
|
+
<tr>
|
|
452
|
+
<td>
|
|
453
|
+
<pre class="lines">
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
19
|
|
457
|
+
20
|
|
458
|
+
21
|
|
459
|
+
22
|
|
460
|
+
23
|
|
461
|
+
24
|
|
462
|
+
25</pre>
|
|
463
|
+
</td>
|
|
464
|
+
<td>
|
|
465
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 19</span>
|
|
466
|
+
|
|
467
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>code:</span><span class='comma'>,</span> <span class='label'>symbol:</span><span class='comma'>,</span> <span class='label'>subunit:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>country:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
468
|
+
<span class='id identifier rubyid_subunit'>subunit</span> <span class='op'>=</span> <span class='id identifier rubyid_subunit'>subunit</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
|
469
|
+
<span class='id identifier rubyid_priority'>priority</span> <span class='op'>=</span> <span class='id identifier rubyid_priority'>priority</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
|
470
|
+
<span class='id identifier rubyid_fractional_multiplier'>fractional_multiplier</span> <span class='op'>=</span> <span class='int'>10</span><span class='op'>**</span><span class='id identifier rubyid_subunit'>subunit</span>
|
|
471
|
+
<span class='kw'>super</span><span class='lparen'>(</span><span class='label'>code:</span><span class='comma'>,</span> <span class='label'>subunit:</span><span class='comma'>,</span> <span class='label'>symbol:</span><span class='comma'>,</span> <span class='label'>priority:</span><span class='comma'>,</span> <span class='label'>country:</span><span class='comma'>,</span> <span class='label'>name:</span><span class='comma'>,</span>
|
|
472
|
+
<span class='label'>fractional_multiplier:</span><span class='rparen'>)</span>
|
|
473
|
+
<span class='kw'>end</span></pre>
|
|
474
|
+
</td>
|
|
475
|
+
</tr>
|
|
476
|
+
</table>
|
|
477
|
+
</div>
|
|
478
|
+
|
|
479
|
+
</div>
|
|
480
|
+
|
|
481
|
+
<div id="instance_attr_details" class="attr_details">
|
|
482
|
+
<h2>Instance Attribute Details</h2>
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
<span id=""></span>
|
|
486
|
+
<div class="method_details first">
|
|
487
|
+
<h3 class="signature first" id="code-instance_method">
|
|
488
|
+
|
|
489
|
+
#<strong>code</strong> ⇒ <tt>String</tt> <span class="extras">(readonly)</span>
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
</h3><div class="docstring">
|
|
496
|
+
<div class="discussion">
|
|
497
|
+
<p>ISO 4217 currency code (e.g., "USD", "EUR")</p>
|
|
498
|
+
|
|
499
|
+
</div>
|
|
500
|
+
</div>
|
|
501
|
+
<div class="tags">
|
|
502
|
+
|
|
503
|
+
<p class="tag_title">Returns:</p>
|
|
504
|
+
<ul class="return">
|
|
505
|
+
|
|
506
|
+
<li>
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
—
|
|
514
|
+
<div class='inline'><p>the current value of code</p></div>
|
|
515
|
+
|
|
516
|
+
</li>
|
|
517
|
+
|
|
518
|
+
</ul>
|
|
519
|
+
|
|
520
|
+
</div><table class="source_code">
|
|
521
|
+
<tr>
|
|
522
|
+
<td>
|
|
523
|
+
<pre class="lines">
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
17
|
|
527
|
+
18
|
|
528
|
+
19</pre>
|
|
529
|
+
</td>
|
|
530
|
+
<td>
|
|
531
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 17</span>
|
|
532
|
+
|
|
533
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_code'>code</span>
|
|
534
|
+
<span class='ivar'>@code</span>
|
|
535
|
+
<span class='kw'>end</span></pre>
|
|
536
|
+
</td>
|
|
537
|
+
</tr>
|
|
538
|
+
</table>
|
|
539
|
+
</div>
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
<span id=""></span>
|
|
543
|
+
<div class="method_details ">
|
|
544
|
+
<h3 class="signature " id="country-instance_method">
|
|
545
|
+
|
|
546
|
+
#<strong>country</strong> ⇒ <tt>String</tt><sup>?</sup> <span class="extras">(readonly)</span>
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
</h3><div class="docstring">
|
|
553
|
+
<div class="discussion">
|
|
554
|
+
<p>Associated country code</p>
|
|
555
|
+
|
|
556
|
+
</div>
|
|
557
|
+
</div>
|
|
558
|
+
<div class="tags">
|
|
559
|
+
|
|
560
|
+
<p class="tag_title">Returns:</p>
|
|
561
|
+
<ul class="return">
|
|
562
|
+
|
|
563
|
+
<li>
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
—
|
|
571
|
+
<div class='inline'><p>the current value of country</p></div>
|
|
572
|
+
|
|
573
|
+
</li>
|
|
574
|
+
|
|
575
|
+
</ul>
|
|
576
|
+
|
|
577
|
+
</div><table class="source_code">
|
|
578
|
+
<tr>
|
|
579
|
+
<td>
|
|
580
|
+
<pre class="lines">
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
17
|
|
584
|
+
18
|
|
585
|
+
19</pre>
|
|
586
|
+
</td>
|
|
587
|
+
<td>
|
|
588
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 17</span>
|
|
589
|
+
|
|
590
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_country'>country</span>
|
|
591
|
+
<span class='ivar'>@country</span>
|
|
592
|
+
<span class='kw'>end</span></pre>
|
|
593
|
+
</td>
|
|
594
|
+
</tr>
|
|
595
|
+
</table>
|
|
596
|
+
</div>
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
<span id=""></span>
|
|
600
|
+
<div class="method_details ">
|
|
601
|
+
<h3 class="signature " id="fractional_multiplier-instance_method">
|
|
602
|
+
|
|
603
|
+
#<strong>fractional_multiplier</strong> ⇒ <tt>Integer</tt> <span class="extras">(readonly)</span>
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
</h3><div class="docstring">
|
|
610
|
+
<div class="discussion">
|
|
611
|
+
<p>10^subunit, used for fractional conversions</p>
|
|
612
|
+
|
|
613
|
+
</div>
|
|
614
|
+
</div>
|
|
615
|
+
<div class="tags">
|
|
616
|
+
|
|
617
|
+
<p class="tag_title">Returns:</p>
|
|
618
|
+
<ul class="return">
|
|
619
|
+
|
|
620
|
+
<li>
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
—
|
|
628
|
+
<div class='inline'><p>the current value of fractional_multiplier</p></div>
|
|
629
|
+
|
|
630
|
+
</li>
|
|
631
|
+
|
|
632
|
+
</ul>
|
|
633
|
+
|
|
634
|
+
</div><table class="source_code">
|
|
635
|
+
<tr>
|
|
636
|
+
<td>
|
|
637
|
+
<pre class="lines">
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
17
|
|
641
|
+
18
|
|
642
|
+
19</pre>
|
|
643
|
+
</td>
|
|
644
|
+
<td>
|
|
645
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 17</span>
|
|
646
|
+
|
|
647
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_fractional_multiplier'>fractional_multiplier</span>
|
|
648
|
+
<span class='ivar'>@fractional_multiplier</span>
|
|
649
|
+
<span class='kw'>end</span></pre>
|
|
650
|
+
</td>
|
|
651
|
+
</tr>
|
|
652
|
+
</table>
|
|
653
|
+
</div>
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
<span id=""></span>
|
|
657
|
+
<div class="method_details ">
|
|
658
|
+
<h3 class="signature " id="name-instance_method">
|
|
659
|
+
|
|
660
|
+
#<strong>name</strong> ⇒ <tt>String</tt><sup>?</sup> <span class="extras">(readonly)</span>
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
</h3><div class="docstring">
|
|
667
|
+
<div class="discussion">
|
|
668
|
+
<p>Currency name</p>
|
|
669
|
+
|
|
670
|
+
</div>
|
|
671
|
+
</div>
|
|
672
|
+
<div class="tags">
|
|
673
|
+
|
|
674
|
+
<p class="tag_title">Returns:</p>
|
|
675
|
+
<ul class="return">
|
|
676
|
+
|
|
677
|
+
<li>
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
—
|
|
685
|
+
<div class='inline'><p>the current value of name</p></div>
|
|
686
|
+
|
|
687
|
+
</li>
|
|
688
|
+
|
|
689
|
+
</ul>
|
|
690
|
+
|
|
691
|
+
</div><table class="source_code">
|
|
692
|
+
<tr>
|
|
693
|
+
<td>
|
|
694
|
+
<pre class="lines">
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
17
|
|
698
|
+
18
|
|
699
|
+
19</pre>
|
|
700
|
+
</td>
|
|
701
|
+
<td>
|
|
702
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 17</span>
|
|
703
|
+
|
|
704
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
|
705
|
+
<span class='ivar'>@name</span>
|
|
706
|
+
<span class='kw'>end</span></pre>
|
|
707
|
+
</td>
|
|
708
|
+
</tr>
|
|
709
|
+
</table>
|
|
710
|
+
</div>
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
<span id=""></span>
|
|
714
|
+
<div class="method_details ">
|
|
715
|
+
<h3 class="signature " id="priority-instance_method">
|
|
716
|
+
|
|
717
|
+
#<strong>priority</strong> ⇒ <tt>Integer</tt> <span class="extras">(readonly)</span>
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
</h3><div class="docstring">
|
|
724
|
+
<div class="discussion">
|
|
725
|
+
<p>Parser precedence for symbol detection</p>
|
|
726
|
+
|
|
727
|
+
</div>
|
|
728
|
+
</div>
|
|
729
|
+
<div class="tags">
|
|
730
|
+
|
|
731
|
+
<p class="tag_title">Returns:</p>
|
|
732
|
+
<ul class="return">
|
|
733
|
+
|
|
734
|
+
<li>
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
—
|
|
742
|
+
<div class='inline'><p>the current value of priority</p></div>
|
|
743
|
+
|
|
744
|
+
</li>
|
|
745
|
+
|
|
746
|
+
</ul>
|
|
747
|
+
|
|
748
|
+
</div><table class="source_code">
|
|
749
|
+
<tr>
|
|
750
|
+
<td>
|
|
751
|
+
<pre class="lines">
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
17
|
|
755
|
+
18
|
|
756
|
+
19</pre>
|
|
757
|
+
</td>
|
|
758
|
+
<td>
|
|
759
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 17</span>
|
|
760
|
+
|
|
761
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_priority'>priority</span>
|
|
762
|
+
<span class='ivar'>@priority</span>
|
|
763
|
+
<span class='kw'>end</span></pre>
|
|
764
|
+
</td>
|
|
765
|
+
</tr>
|
|
766
|
+
</table>
|
|
767
|
+
</div>
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
<span id=""></span>
|
|
771
|
+
<div class="method_details ">
|
|
772
|
+
<h3 class="signature " id="subunit-instance_method">
|
|
773
|
+
|
|
774
|
+
#<strong>subunit</strong> ⇒ <tt>Integer</tt> <span class="extras">(readonly)</span>
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
</h3><div class="docstring">
|
|
781
|
+
<div class="discussion">
|
|
782
|
+
<p>Number of decimal places (0 for JPY, 2 for USD, 3 for IQD)</p>
|
|
783
|
+
|
|
784
|
+
</div>
|
|
785
|
+
</div>
|
|
786
|
+
<div class="tags">
|
|
787
|
+
|
|
788
|
+
<p class="tag_title">Returns:</p>
|
|
789
|
+
<ul class="return">
|
|
790
|
+
|
|
791
|
+
<li>
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
—
|
|
799
|
+
<div class='inline'><p>the current value of subunit</p></div>
|
|
800
|
+
|
|
801
|
+
</li>
|
|
802
|
+
|
|
803
|
+
</ul>
|
|
804
|
+
|
|
805
|
+
</div><table class="source_code">
|
|
806
|
+
<tr>
|
|
807
|
+
<td>
|
|
808
|
+
<pre class="lines">
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
17
|
|
812
|
+
18
|
|
813
|
+
19</pre>
|
|
814
|
+
</td>
|
|
815
|
+
<td>
|
|
816
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 17</span>
|
|
817
|
+
|
|
818
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_subunit'>subunit</span>
|
|
819
|
+
<span class='ivar'>@subunit</span>
|
|
820
|
+
<span class='kw'>end</span></pre>
|
|
821
|
+
</td>
|
|
822
|
+
</tr>
|
|
823
|
+
</table>
|
|
824
|
+
</div>
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
<span id=""></span>
|
|
828
|
+
<div class="method_details ">
|
|
829
|
+
<h3 class="signature " id="symbol-instance_method">
|
|
830
|
+
|
|
831
|
+
#<strong>symbol</strong> ⇒ <tt>String</tt> <span class="extras">(readonly)</span>
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
</h3><div class="docstring">
|
|
838
|
+
<div class="discussion">
|
|
839
|
+
<p>Display symbol (e.g., "$", "€", "R$")</p>
|
|
840
|
+
|
|
841
|
+
</div>
|
|
842
|
+
</div>
|
|
843
|
+
<div class="tags">
|
|
844
|
+
|
|
845
|
+
<p class="tag_title">Returns:</p>
|
|
846
|
+
<ul class="return">
|
|
847
|
+
|
|
848
|
+
<li>
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
—
|
|
856
|
+
<div class='inline'><p>the current value of symbol</p></div>
|
|
857
|
+
|
|
858
|
+
</li>
|
|
859
|
+
|
|
860
|
+
</ul>
|
|
861
|
+
|
|
862
|
+
</div><table class="source_code">
|
|
863
|
+
<tr>
|
|
864
|
+
<td>
|
|
865
|
+
<pre class="lines">
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
17
|
|
869
|
+
18
|
|
870
|
+
19</pre>
|
|
871
|
+
</td>
|
|
872
|
+
<td>
|
|
873
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 17</span>
|
|
874
|
+
|
|
875
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_symbol'>symbol</span>
|
|
876
|
+
<span class='ivar'>@symbol</span>
|
|
877
|
+
<span class='kw'>end</span></pre>
|
|
878
|
+
</td>
|
|
879
|
+
</tr>
|
|
880
|
+
</table>
|
|
881
|
+
</div>
|
|
882
|
+
|
|
883
|
+
</div>
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
<div id="instance_method_details" class="method_details_list">
|
|
887
|
+
<h2>Instance Method Details</h2>
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
<div class="method_details first">
|
|
891
|
+
<h3 class="signature first" id="inspect-instance_method">
|
|
892
|
+
|
|
893
|
+
#<strong>inspect</strong> ⇒ <tt>Object</tt>
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
</h3><table class="source_code">
|
|
900
|
+
<tr>
|
|
901
|
+
<td>
|
|
902
|
+
<pre class="lines">
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
27</pre>
|
|
906
|
+
</td>
|
|
907
|
+
<td>
|
|
908
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 27</span>
|
|
909
|
+
|
|
910
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'><Currency:(</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_code'>code</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_symbol'>symbol</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_subunit'>subunit</span><span class='embexpr_end'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>)></span><span class='tstring_end'>"</span></span></pre>
|
|
911
|
+
</td>
|
|
912
|
+
</tr>
|
|
913
|
+
</table>
|
|
914
|
+
</div>
|
|
915
|
+
|
|
916
|
+
<div class="method_details ">
|
|
917
|
+
<h3 class="signature " id="minimum_amount-instance_method">
|
|
918
|
+
|
|
919
|
+
#<strong>minimum_amount</strong> ⇒ <tt>Object</tt>
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
</h3><table class="source_code">
|
|
926
|
+
<tr>
|
|
927
|
+
<td>
|
|
928
|
+
<pre class="lines">
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
29</pre>
|
|
932
|
+
</td>
|
|
933
|
+
<td>
|
|
934
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 29</span>
|
|
935
|
+
|
|
936
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_minimum_amount'>minimum_amount</span> <span class='op'>=</span> <span class='const'>Rational</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_fractional_multiplier'>fractional_multiplier</span><span class='rparen'>)</span></pre>
|
|
937
|
+
</td>
|
|
938
|
+
</tr>
|
|
939
|
+
</table>
|
|
940
|
+
</div>
|
|
941
|
+
|
|
942
|
+
<div class="method_details ">
|
|
943
|
+
<h3 class="signature " id="normalize_amount-instance_method">
|
|
944
|
+
|
|
945
|
+
#<strong>normalize_amount</strong>(amount) ⇒ <tt>Object</tt>
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
</h3><div class="docstring">
|
|
952
|
+
<div class="discussion">
|
|
953
|
+
<p>Normalizes numeric amounts for this currency</p>
|
|
954
|
+
<ol>
|
|
955
|
+
<li>Converts to Rational</li>
|
|
956
|
+
<li>Rounds to respect currency subunit</li>
|
|
957
|
+
</ol>
|
|
958
|
+
|
|
959
|
+
</div>
|
|
960
|
+
</div>
|
|
961
|
+
<div class="tags">
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
</div><table class="source_code">
|
|
965
|
+
<tr>
|
|
966
|
+
<td>
|
|
967
|
+
<pre class="lines">
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
34</pre>
|
|
971
|
+
</td>
|
|
972
|
+
<td>
|
|
973
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/currency/currency.rb', line 34</span>
|
|
974
|
+
|
|
975
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_normalize_amount'>normalize_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='rparen'>)</span> <span class='op'>=</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_to_r'>to_r</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='id identifier rubyid_subunit'>subunit</span><span class='rparen'>)</span></pre>
|
|
976
|
+
</td>
|
|
977
|
+
</tr>
|
|
978
|
+
</table>
|
|
979
|
+
</div>
|
|
980
|
+
|
|
981
|
+
</div>
|
|
982
|
+
|
|
983
|
+
</div>
|
|
984
|
+
|
|
985
|
+
<div id="footer">
|
|
986
|
+
Generated on Wed Jun 10 01:35:30 2026 by
|
|
987
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
988
|
+
0.9.44 (ruby-4.0.1).
|
|
989
|
+
</div>
|
|
990
|
+
|
|
991
|
+
</div>
|
|
992
|
+
</body>
|
|
993
|
+
</html>
|