minting 1.7.2 → 1.7.3
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 +16 -1
- data/doc/Mint/Currency.html +285 -31
- data/doc/Mint/Money.html +79 -56
- data/doc/Mint/RangeStepPatch.html +1 -1
- data/doc/Mint/Registry.html +842 -0
- data/doc/Mint/UnknownCurrency.html +1 -1
- data/doc/Mint.html +345 -51
- data/doc/Minting.html +2 -2
- data/doc/_index.html +8 -8
- data/doc/agents/api_review-2026-06-15.md +342 -0
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +13 -2
- data/doc/index.html +13 -2
- data/doc/method_list.html +100 -36
- data/doc/top-level-namespace.html +1 -1
- data/lib/minting/currency/currency.rb +31 -0
- data/lib/minting/mint/locale_backend.rb +29 -0
- data/lib/minting/mint/mint.rb +23 -21
- data/lib/minting/mint/parser/parser.rb +3 -7
- data/lib/minting/mint/registry/registration.rb +33 -0
- data/lib/minting/mint/registry/registry.rb +38 -0
- data/lib/minting/mint/registry/symbols.rb +49 -0
- data/lib/minting/mint/registry/zeros.rb +18 -0
- data/lib/minting/mint.rb +13 -25
- data/lib/minting/money/constructors.rb +6 -11
- data/lib/minting/money/format/formatting.rb +16 -0
- data/lib/minting/money/format/to_s.rb +13 -4
- data/lib/minting/money/money.rb +12 -0
- data/lib/minting/version.rb +1 -1
- metadata +13 -8
- data/lib/minting/currency/currency_registry.rb +0 -67
- data/lib/minting/currency/world_currencies.rb +0 -16
- /data/doc/agents/{AGENTS.md → expired/AGENTS.md} +0 -0
- /data/doc/agents/{copilot-instructions.md → expired/copilot-instructions.md} +0 -0
- /data/doc/agents/{gemini_gem_evaluation.md → expired/gemini_gem_evaluation.md} +0 -0
- /data/doc/agents/{recommendations.md → expired/recommendations.md} +0 -0
- /data/doc/agents/{rubocop-issues.md → expired/rubocop-issues.md} +0 -0
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
</div>
|
|
127
127
|
|
|
128
128
|
<div id="footer">
|
|
129
|
-
Generated on
|
|
129
|
+
Generated on Mon Jun 15 19:57:57 2026 by
|
|
130
130
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
131
131
|
0.9.44 (ruby-4.0.5).
|
|
132
132
|
</div>
|
data/doc/Mint.html
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
<dl>
|
|
92
92
|
<dt>Defined in:</dt>
|
|
93
93
|
<dd>lib/minting/mint/mint.rb<span class="defines">,<br>
|
|
94
|
-
lib/minting/money/clamp.rb,<br> lib/minting/money/money.rb,<br> lib/minting/mint/dsl/range.rb,<br> lib/minting/money/coercion.rb,<br> lib/minting/mint/dsl/string.rb,<br> lib/minting/mint/dsl/numeric.rb,<br> lib/minting/money/comparable.rb,<br> lib/minting/money/conversion.rb,<br> lib/minting/currency/currency.rb,<br> lib/minting/money/format/to_s.rb,<br> lib/minting/mint/dsl/top_level.rb,<br> lib/minting/mint/parser/parser.rb,<br> lib/minting/money/constructors.rb,<br> lib/minting/mint/parser/separators.rb,<br> lib/minting/
|
|
94
|
+
lib/minting/money/clamp.rb,<br> lib/minting/money/money.rb,<br> lib/minting/mint/dsl/range.rb,<br> lib/minting/money/coercion.rb,<br> lib/minting/mint/dsl/string.rb,<br> lib/minting/mint/dsl/numeric.rb,<br> lib/minting/money/comparable.rb,<br> lib/minting/money/conversion.rb,<br> lib/minting/currency/currency.rb,<br> lib/minting/money/format/to_s.rb,<br> lib/minting/mint/dsl/top_level.rb,<br> lib/minting/mint/parser/parser.rb,<br> lib/minting/money/constructors.rb,<br> lib/minting/mint/locale_backend.rb,<br> lib/minting/mint/registry/zeros.rb,<br> lib/minting/mint/registry/symbols.rb,<br> lib/minting/mint/parser/separators.rb,<br> lib/minting/mint/registry/registry.rb,<br> lib/minting/money/allocation/split.rb,<br> lib/minting/money/format/formatting.rb,<br> lib/minting/money/arithmetics/methods.rb,<br> lib/minting/mint/registry/registration.rb,<br> lib/minting/money/allocation/allocation.rb,<br> lib/minting/money/arithmetics/operators.rb</span>
|
|
95
95
|
|
|
96
96
|
</dd>
|
|
97
97
|
</dl>
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
|
|
101
101
|
<h2>Overview</h2><div class="docstring">
|
|
102
102
|
<div class="discussion">
|
|
103
|
-
<p>Mint
|
|
103
|
+
<p>Mint registry: manages all cached state</p>
|
|
104
104
|
|
|
105
105
|
</div>
|
|
106
106
|
</div>
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
<p class="children">
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Mint/
|
|
114
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Mint/RangeStepPatch.html" title="Mint::RangeStepPatch (module)">RangeStepPatch</a></span>, <span class='object_link'><a href="Mint/Registry.html" title="Mint::Registry (module)">Registry</a></span>
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
@@ -123,6 +123,36 @@
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
|
+
<h2>Class Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
127
|
+
<ul class="summary">
|
|
128
|
+
|
|
129
|
+
<li class="public ">
|
|
130
|
+
<span class="summary_signature">
|
|
131
|
+
|
|
132
|
+
<a href="#locale_backend-class_method" title="locale_backend (class method)">.<strong>locale_backend</strong> ⇒ Proc, ... </a>
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
</span>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
<span class="summary_desc"><div class='inline'><p>Optional callable that returns a Hash with locale-aware formatting defaults.</p></div></span>
|
|
150
|
+
|
|
151
|
+
</li>
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
</ul>
|
|
155
|
+
|
|
126
156
|
|
|
127
157
|
|
|
128
158
|
|
|
@@ -137,7 +167,29 @@
|
|
|
137
167
|
<li class="public ">
|
|
138
168
|
<span class="summary_signature">
|
|
139
169
|
|
|
140
|
-
<a href="#
|
|
170
|
+
<a href="#currency_for_code-class_method" title="currency_for_code (class method)">.<strong>currency_for_code</strong>(code) ⇒ Currency<sup>?</sup> </a>
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
</span>
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
<span class="summary_desc"><div class='inline'><p>Looks up a registered currency by its alpha code.</p></div></span>
|
|
185
|
+
|
|
186
|
+
</li>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
<li class="public ">
|
|
190
|
+
<span class="summary_signature">
|
|
191
|
+
|
|
192
|
+
<a href="#currency_for_symbol-class_method" title="currency_for_symbol (class method)">.<strong>currency_for_symbol</strong>(symbol) ⇒ Currency<sup>?</sup> </a>
|
|
141
193
|
|
|
142
194
|
|
|
143
195
|
|
|
@@ -151,7 +203,7 @@
|
|
|
151
203
|
|
|
152
204
|
|
|
153
205
|
|
|
154
|
-
<span class="summary_desc"><div class='inline'><p>
|
|
206
|
+
<span class="summary_desc"><div class='inline'><p>Looks up a currency by its display symbol.</p></div></span>
|
|
155
207
|
|
|
156
208
|
</li>
|
|
157
209
|
|
|
@@ -239,7 +291,29 @@
|
|
|
239
291
|
<span class="private note title">private</span>
|
|
240
292
|
|
|
241
293
|
|
|
242
|
-
<span class="summary_desc"><div class='inline'><p>
|
|
294
|
+
<span class="summary_desc"><div class='inline'><p>The frozen world-currencies hash.</p></div></span>
|
|
295
|
+
|
|
296
|
+
</li>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
<li class="public ">
|
|
300
|
+
<span class="summary_signature">
|
|
301
|
+
|
|
302
|
+
<a href="#zero-class_method" title="zero (class method)">.<strong>zero</strong>(currency) ⇒ Money </a>
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
</span>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
<span class="summary_desc"><div class='inline'><p>Returns a zero <span class='object_link'><a href="Mint/Money.html" title="Mint::Money (class)">Money</a></span> in the given currency, useful as a default value for discounts, totals, or placeholders.</p></div></span>
|
|
243
317
|
|
|
244
318
|
</li>
|
|
245
319
|
|
|
@@ -281,15 +355,98 @@
|
|
|
281
355
|
|
|
282
356
|
|
|
283
357
|
|
|
358
|
+
<div id="class_attr_details" class="attr_details">
|
|
359
|
+
<h2>Class Attribute Details</h2>
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
<span id="locale_backend=-class_method"></span>
|
|
363
|
+
<div class="method_details first">
|
|
364
|
+
<h3 class="signature first" id="locale_backend-class_method">
|
|
365
|
+
|
|
366
|
+
.<strong>locale_backend</strong> ⇒ <tt>Proc</tt>, ...
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
</h3><div class="docstring">
|
|
373
|
+
<div class="discussion">
|
|
374
|
+
<p>Optional callable that returns a Hash with locale-aware formatting defaults.</p>
|
|
375
|
+
<p>The callable receives no arguments and returns a Hash with these keys:</p>
|
|
376
|
+
<pre class="code ruby"><code class="ruby">[+:decimal+] Decimal separator (e.g. +","+)
|
|
377
|
+
[+:thousand+] Thousands delimiter (e.g. +"."+)
|
|
378
|
+
[+:format+] Format template string (e.g. +"%<amount>f %<symbol>s"+)
|
|
379
|
+
</code></pre>
|
|
380
|
+
<p>When set, <code>#to_s</code> and <code>#format</code> use these values as fallbacks when the
|
|
381
|
+
corresponding parameter is not explicitly provided.</p>
|
|
382
|
+
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
<div class="tags">
|
|
386
|
+
|
|
387
|
+
<div class="examples">
|
|
388
|
+
<h4 class="tag_title">Examples:</h4>
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
<h5 class="example_title"><div class='inline'><p>Rails I18n integration (in minting-rails railtie)</p></div></h5>
|
|
392
|
+
|
|
393
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="Mint (module)">Mint</a></span></span><span class='period'>.</span><span class='id identifier rubyid_locale_backend'>locale_backend</span> <span class='op'>=</span> <span class='tlambda'>-></span> <span class='tlambeg'>{</span>
|
|
394
|
+
<span class='id identifier rubyid_fmt'>fmt</span> <span class='op'>=</span> <span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>number.currency.format</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
395
|
+
<span class='lbrace'>{</span>
|
|
396
|
+
<span class='label'>decimal:</span> <span class='id identifier rubyid_fmt'>fmt</span><span class='lbracket'>[</span><span class='symbol'>:separator</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
|
397
|
+
<span class='label'>thousand:</span> <span class='id identifier rubyid_fmt'>fmt</span><span class='lbracket'>[</span><span class='symbol'>:delimiter</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
|
398
|
+
<span class='label'>format:</span> <span class='id identifier rubyid_fmt'>fmt</span><span class='lbracket'>[</span><span class='symbol'>:format</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%n %u</span><span class='tstring_end'>'</span></span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%<amount>f %<symbol>s</span><span class='tstring_end'>'</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%<symbol>s%<amount>f</span><span class='tstring_end'>'</span></span>
|
|
399
|
+
<span class='rbrace'>}</span>
|
|
400
|
+
<span class='rbrace'>}</span></code></pre>
|
|
401
|
+
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
<p class="tag_title">Returns:</p>
|
|
405
|
+
<ul class="return">
|
|
406
|
+
|
|
407
|
+
<li>
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
<span class='type'>(<tt>Proc</tt>, <tt>#call</tt>, <tt>nil</tt>)</span>
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
</li>
|
|
415
|
+
|
|
416
|
+
</ul>
|
|
417
|
+
|
|
418
|
+
</div><table class="source_code">
|
|
419
|
+
<tr>
|
|
420
|
+
<td>
|
|
421
|
+
<pre class="lines">
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
27
|
|
425
|
+
28
|
|
426
|
+
29</pre>
|
|
427
|
+
</td>
|
|
428
|
+
<td>
|
|
429
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/locale_backend.rb', line 27</span>
|
|
430
|
+
|
|
431
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_locale_backend'>locale_backend</span>
|
|
432
|
+
<span class='ivar'>@locale_backend</span>
|
|
433
|
+
<span class='kw'>end</span></pre>
|
|
434
|
+
</td>
|
|
435
|
+
</tr>
|
|
436
|
+
</table>
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
</div>
|
|
440
|
+
|
|
284
441
|
|
|
285
442
|
<div id="class_method_details" class="method_details_list">
|
|
286
443
|
<h2>Class Method Details</h2>
|
|
287
444
|
|
|
288
445
|
|
|
289
446
|
<div class="method_details first">
|
|
290
|
-
<h3 class="signature first" id="
|
|
447
|
+
<h3 class="signature first" id="currency_for_code-class_method">
|
|
291
448
|
|
|
292
|
-
.<strong>
|
|
449
|
+
.<strong>currency_for_code</strong>(code) ⇒ <tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt><sup>?</sup>
|
|
293
450
|
|
|
294
451
|
|
|
295
452
|
|
|
@@ -297,8 +454,8 @@
|
|
|
297
454
|
|
|
298
455
|
</h3><div class="docstring">
|
|
299
456
|
<div class="discussion">
|
|
300
|
-
<p>
|
|
301
|
-
|
|
457
|
+
<p>Looks up a registered currency by its alpha code.</p>
|
|
458
|
+
<p>Unlike currency, this performs a direct hash lookup and only accepts strings.</p>
|
|
302
459
|
|
|
303
460
|
</div>
|
|
304
461
|
</div>
|
|
@@ -308,15 +465,15 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
308
465
|
|
|
309
466
|
<li>
|
|
310
467
|
|
|
311
|
-
<span class='name'>
|
|
468
|
+
<span class='name'>code</span>
|
|
312
469
|
|
|
313
470
|
|
|
314
|
-
<span class='type'>(<tt>String</tt
|
|
471
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
315
472
|
|
|
316
473
|
|
|
317
474
|
|
|
318
475
|
—
|
|
319
|
-
<div class='inline'><p>the currency
|
|
476
|
+
<div class='inline'><p>the currency code</p></div>
|
|
320
477
|
|
|
321
478
|
</li>
|
|
322
479
|
|
|
@@ -333,7 +490,7 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
333
490
|
|
|
334
491
|
|
|
335
492
|
—
|
|
336
|
-
<div class='inline'><p>the registered Currency
|
|
493
|
+
<div class='inline'><p>the registered Currency, or <code>nil</code> if not found</p></div>
|
|
337
494
|
|
|
338
495
|
</li>
|
|
339
496
|
|
|
@@ -345,25 +502,88 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
345
502
|
<pre class="lines">
|
|
346
503
|
|
|
347
504
|
|
|
348
|
-
22
|
|
349
|
-
23
|
|
350
|
-
24
|
|
351
|
-
25
|
|
352
|
-
26
|
|
353
505
|
27
|
|
354
506
|
28
|
|
355
507
|
29</pre>
|
|
356
508
|
</td>
|
|
357
509
|
<td>
|
|
358
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line
|
|
359
|
-
|
|
360
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier
|
|
361
|
-
<span class='
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
510
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 27</span>
|
|
511
|
+
|
|
512
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_currency_for_code'>currency_for_code</span><span class='lparen'>(</span><span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span>
|
|
513
|
+
<span class='const'><span class='object_link'><a href="Mint/Registry.html" title="Mint::Registry (module)">Registry</a></span></span><span class='period'>.</span><span class='id identifier rubyid_currencies'><span class='object_link'><a href="Mint/Registry.html#currencies-class_method" title="Mint::Registry.currencies (method)">currencies</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_code'>code</span><span class='rbracket'>]</span>
|
|
514
|
+
<span class='kw'>end</span></pre>
|
|
515
|
+
</td>
|
|
516
|
+
</tr>
|
|
517
|
+
</table>
|
|
518
|
+
</div>
|
|
519
|
+
|
|
520
|
+
<div class="method_details ">
|
|
521
|
+
<h3 class="signature " id="currency_for_symbol-class_method">
|
|
522
|
+
|
|
523
|
+
.<strong>currency_for_symbol</strong>(symbol) ⇒ <tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt><sup>?</sup>
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
</h3><div class="docstring">
|
|
530
|
+
<div class="discussion">
|
|
531
|
+
<p>Looks up a currency by its display symbol.</p>
|
|
532
|
+
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
<div class="tags">
|
|
536
|
+
<p class="tag_title">Parameters:</p>
|
|
537
|
+
<ul class="param">
|
|
538
|
+
|
|
539
|
+
<li>
|
|
540
|
+
|
|
541
|
+
<span class='name'>symbol</span>
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
—
|
|
549
|
+
<div class='inline'><p>the display symbol (e.g. "$", "R$")</p></div>
|
|
550
|
+
|
|
551
|
+
</li>
|
|
552
|
+
|
|
553
|
+
</ul>
|
|
554
|
+
|
|
555
|
+
<p class="tag_title">Returns:</p>
|
|
556
|
+
<ul class="return">
|
|
557
|
+
|
|
558
|
+
<li>
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
<span class='type'>(<tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt>, <tt>nil</tt>)</span>
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
—
|
|
566
|
+
<div class='inline'><p>the highest-priority currency for the symbol</p></div>
|
|
567
|
+
|
|
568
|
+
</li>
|
|
569
|
+
|
|
570
|
+
</ul>
|
|
571
|
+
|
|
572
|
+
</div><table class="source_code">
|
|
573
|
+
<tr>
|
|
574
|
+
<td>
|
|
575
|
+
<pre class="lines">
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
35
|
|
579
|
+
36
|
|
580
|
+
37</pre>
|
|
581
|
+
</td>
|
|
582
|
+
<td>
|
|
583
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 35</span>
|
|
584
|
+
|
|
585
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_currency_for_symbol'>currency_for_symbol</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rparen'>)</span>
|
|
586
|
+
<span class='const'><span class='object_link'><a href="Mint/Registry.html" title="Mint::Registry (module)">Registry</a></span></span><span class='period'>.</span><span class='id identifier rubyid_currency_for_symbol'><span class='object_link'><a href="Mint/Registry.html#currency_for_symbol-instance_method" title="Mint::Registry#currency_for_symbol (method)">currency_for_symbol</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rparen'>)</span>
|
|
367
587
|
<span class='kw'>end</span></pre>
|
|
368
588
|
</td>
|
|
369
589
|
</tr>
|
|
@@ -603,15 +823,15 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
603
823
|
<pre class="lines">
|
|
604
824
|
|
|
605
825
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
826
|
+
56
|
|
827
|
+
57
|
|
828
|
+
58</pre>
|
|
609
829
|
</td>
|
|
610
830
|
<td>
|
|
611
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line
|
|
831
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 56</span>
|
|
612
832
|
|
|
613
833
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_register_currency'>register_currency</span><span class='lparen'>(</span><span class='label'>code:</span><span class='comma'>,</span> <span class='label'>subunit:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>symbol:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>0</span><span class='rparen'>)</span>
|
|
614
|
-
<span class='const'><span class='object_link'><a href="Mint/
|
|
834
|
+
<span class='const'><span class='object_link'><a href="Mint/Registry.html" title="Mint::Registry (module)">Registry</a></span></span><span class='period'>.</span><span class='id identifier rubyid_register'><span class='object_link'><a href="Mint/Registry.html#register-class_method" title="Mint::Registry.register (method)">register</a></span></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='rparen'>)</span>
|
|
615
835
|
<span class='kw'>end</span></pre>
|
|
616
836
|
</td>
|
|
617
837
|
</tr>
|
|
@@ -700,7 +920,7 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
700
920
|
<strong>This method is part of a private API.</strong>
|
|
701
921
|
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
|
702
922
|
</p>
|
|
703
|
-
<p>
|
|
923
|
+
<p>Returns the frozen world-currencies hash.</p>
|
|
704
924
|
|
|
705
925
|
</div>
|
|
706
926
|
</div>
|
|
@@ -717,7 +937,7 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
717
937
|
|
|
718
938
|
|
|
719
939
|
—
|
|
720
|
-
<div class='inline'><p>
|
|
940
|
+
<div class='inline'><p>the frozen world-currencies hash</p></div>
|
|
721
941
|
|
|
722
942
|
</li>
|
|
723
943
|
|
|
@@ -729,24 +949,98 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
729
949
|
<pre class="lines">
|
|
730
950
|
|
|
731
951
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
15</pre>
|
|
952
|
+
19</pre>
|
|
953
|
+
</td>
|
|
954
|
+
<td>
|
|
955
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 19</span>
|
|
956
|
+
|
|
957
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_world_currencies'>world_currencies</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Mint/Registry.html" title="Mint::Registry (module)">Registry</a></span></span><span class='period'>.</span><span class='id identifier rubyid_world_currencies'><span class='object_link'><a href="Mint/Registry.html#world_currencies-class_method" title="Mint::Registry.world_currencies (method)">world_currencies</a></span></span></pre>
|
|
739
958
|
</td>
|
|
959
|
+
</tr>
|
|
960
|
+
</table>
|
|
961
|
+
</div>
|
|
962
|
+
|
|
963
|
+
<div class="method_details ">
|
|
964
|
+
<h3 class="signature " id="zero-class_method">
|
|
965
|
+
|
|
966
|
+
.<strong>zero</strong>(currency) ⇒ <tt><span class='object_link'><a href="Mint/Money.html" title="Mint::Money (class)">Money</a></span></tt>
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
</h3><div class="docstring">
|
|
973
|
+
<div class="discussion">
|
|
974
|
+
<p>Returns a zero <span class='object_link'><a href="Mint/Money.html" title="Mint::Money (class)">Money</a></span> in the given currency, useful as a default value
|
|
975
|
+
for discounts, totals, or placeholders.</p>
|
|
976
|
+
|
|
977
|
+
</div>
|
|
978
|
+
</div>
|
|
979
|
+
<div class="tags">
|
|
980
|
+
<p class="tag_title">Parameters:</p>
|
|
981
|
+
<ul class="param">
|
|
982
|
+
|
|
983
|
+
<li>
|
|
984
|
+
|
|
985
|
+
<span class='name'>currency</span>
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
<span class='type'>(<tt>String</tt>, <tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt>)</span>
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
—
|
|
993
|
+
<div class='inline'><p>a currency code or object</p></div>
|
|
994
|
+
|
|
995
|
+
</li>
|
|
996
|
+
|
|
997
|
+
</ul>
|
|
998
|
+
|
|
999
|
+
<p class="tag_title">Returns:</p>
|
|
1000
|
+
<ul class="return">
|
|
1001
|
+
|
|
1002
|
+
<li>
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
<span class='type'>(<tt><span class='object_link'><a href="Mint/Money.html" title="Mint::Money (class)">Money</a></span></tt>)</span>
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
—
|
|
1010
|
+
<div class='inline'><p>a frozen zero-Money</p></div>
|
|
1011
|
+
|
|
1012
|
+
</li>
|
|
1013
|
+
|
|
1014
|
+
</ul>
|
|
1015
|
+
<p class="tag_title">Raises:</p>
|
|
1016
|
+
<ul class="raise">
|
|
1017
|
+
|
|
1018
|
+
<li>
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
—
|
|
1026
|
+
<div class='inline'><p>if the currency can't be resolved</p></div>
|
|
1027
|
+
|
|
1028
|
+
</li>
|
|
1029
|
+
|
|
1030
|
+
</ul>
|
|
1031
|
+
|
|
1032
|
+
</div><table class="source_code">
|
|
1033
|
+
<tr>
|
|
740
1034
|
<td>
|
|
741
|
-
<pre class="
|
|
1035
|
+
<pre class="lines">
|
|
742
1036
|
|
|
743
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_world_currencies'>world_currencies</span>
|
|
744
|
-
<span class='ivar'>@world_currencies</span> <span class='op'>||=</span> <span class='kw'>begin</span>
|
|
745
|
-
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>../data</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid___dir__'>__dir__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>world-currencies.yaml</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
|
746
1037
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
<
|
|
1038
|
+
45</pre>
|
|
1039
|
+
</td>
|
|
1040
|
+
<td>
|
|
1041
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 45</span>
|
|
1042
|
+
|
|
1043
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_zero'>zero</span><span class='lparen'>(</span><span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Mint/Registry.html" title="Mint::Registry (module)">Registry</a></span></span><span class='period'>.</span><span class='id identifier rubyid_zero_for'><span class='object_link'><a href="Mint/Registry.html#zero_for-class_method" title="Mint::Registry.zero_for (method)">zero_for</a></span></span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></span><span class='period'>.</span><span class='id identifier rubyid_resolve!'><span class='object_link'><a href="Mint/Currency.html#resolve!-class_method" title="Mint::Currency.resolve! (method)">resolve!</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span><span class='rparen'>)</span></pre>
|
|
750
1044
|
</td>
|
|
751
1045
|
</tr>
|
|
752
1046
|
</table>
|
|
@@ -885,7 +1179,7 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
885
1179
|
<span class='id identifier rubyid_input'>input</span> <span class='op'>=</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
|
886
1180
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>input cannot be empty</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
|
887
1181
|
|
|
888
|
-
<span class='id identifier rubyid_currency'>currency</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="Mint (
|
|
1182
|
+
<span class='id identifier rubyid_currency'>currency</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></span><span class='period'>.</span><span class='id identifier rubyid_resolve'><span class='object_link'><a href="Mint/Currency.html#resolve-class_method" title="Mint::Currency.resolve (method)">resolve</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_parse_currency'>parse_currency</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span>
|
|
889
1183
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</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_currency'>currency</span><span class='embexpr_end'>}</span><span class='tstring_content'>] not registered</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_currency'>currency</span>
|
|
890
1184
|
|
|
891
1185
|
<span class='id identifier rubyid_amount'>amount</span> <span class='op'>=</span> <span class='id identifier rubyid_currency'>currency</span><span class='period'>.</span><span class='id identifier rubyid_normalize_amount'>normalize_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_parse_amount'>parse_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
@@ -901,7 +1195,7 @@ or retrieves it directly if already a Currency object.</p>
|
|
|
901
1195
|
</div>
|
|
902
1196
|
|
|
903
1197
|
<div id="footer">
|
|
904
|
-
Generated on
|
|
1198
|
+
Generated on Mon Jun 15 19:57:57 2026 by
|
|
905
1199
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
906
1200
|
0.9.44 (ruby-4.0.5).
|
|
907
1201
|
</div>
|
data/doc/Minting.html
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
|
|
117
117
|
</div>
|
|
118
118
|
</dt>
|
|
119
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.7.
|
|
119
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.7.2</span><span class='tstring_end'>'</span></span></pre></dd>
|
|
120
120
|
|
|
121
121
|
</dl>
|
|
122
122
|
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
</div>
|
|
133
133
|
|
|
134
134
|
<div id="footer">
|
|
135
|
-
Generated on
|
|
135
|
+
Generated on Mon Jun 15 19:57:57 2026 by
|
|
136
136
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
137
137
|
0.9.44 (ruby-4.0.5).
|
|
138
138
|
</div>
|
data/doc/_index.html
CHANGED
|
@@ -89,13 +89,6 @@
|
|
|
89
89
|
|
|
90
90
|
</li>
|
|
91
91
|
|
|
92
|
-
<li>
|
|
93
|
-
<span class='object_link'><a href="Mint/CurrencyRegistry.html" title="Mint::CurrencyRegistry (module)">CurrencyRegistry</a></span>
|
|
94
|
-
|
|
95
|
-
<small>(Mint)</small>
|
|
96
|
-
|
|
97
|
-
</li>
|
|
98
|
-
|
|
99
92
|
</ul>
|
|
100
93
|
</ul>
|
|
101
94
|
|
|
@@ -136,6 +129,13 @@
|
|
|
136
129
|
|
|
137
130
|
</li>
|
|
138
131
|
|
|
132
|
+
<li>
|
|
133
|
+
<span class='object_link'><a href="Mint/Registry.html" title="Mint::Registry (module)">Registry</a></span>
|
|
134
|
+
|
|
135
|
+
<small>(Mint)</small>
|
|
136
|
+
|
|
137
|
+
</li>
|
|
138
|
+
|
|
139
139
|
</ul>
|
|
140
140
|
</ul>
|
|
141
141
|
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
</div>
|
|
164
164
|
|
|
165
165
|
<div id="footer">
|
|
166
|
-
Generated on
|
|
166
|
+
Generated on Mon Jun 15 19:57:57 2026 by
|
|
167
167
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
168
168
|
0.9.44 (ruby-4.0.5).
|
|
169
169
|
</div>
|