minting 1.9.6 → 1.9.7
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 +30 -25
- data/Rakefile +16 -20
- data/bin/bench_check +2 -2
- data/doc/Mint/Currency.html +183 -94
- data/doc/Mint/Money.html +866 -334
- data/doc/Mint/RangeStepPatch.html +1 -1
- data/doc/Mint/Registry.html +10 -10
- data/doc/Mint/Rounding.html +2 -2
- data/doc/Mint/UnknownCurrency.html +6 -4
- data/doc/Mint.html +33 -106
- data/doc/Minting.html +2 -2
- data/doc/Numeric.html +479 -0
- data/doc/String.html +241 -0
- data/doc/_index.html +27 -1
- data/doc/agents/copilot-instructions.md +3 -3
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +47 -33
- data/doc/index.html +47 -33
- data/doc/method_list.html +125 -53
- data/doc/top-level-namespace.html +5 -21
- data/lib/minting/currency/currency.rb +6 -3
- data/lib/minting/data/world-currencies.yaml +75 -23
- data/lib/minting/mint/i18n.rb +1 -1
- data/lib/minting/mint/rounding.rb +1 -0
- data/lib/minting/money/conversion.rb +1 -0
- data/lib/minting/money/format/formatting.rb +88 -55
- data/lib/minting/money/format/to_s.rb +20 -3
- data/lib/minting/money/money.rb +0 -4
- data/lib/minting/version.rb +1 -1
- metadata +3 -2
- data/doc/Mint/CurrencyRegistry.html +0 -511
|
@@ -267,7 +267,7 @@ Overrides Range#step to handle Mint::Money step sizes on Ruby < 4.0.</p>
|
|
|
267
267
|
</div>
|
|
268
268
|
|
|
269
269
|
<div id="footer">
|
|
270
|
-
Generated on
|
|
270
|
+
Generated on Wed Jul 1 01:11:52 2026 by
|
|
271
271
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
272
272
|
0.9.44 (ruby-4.0.5).
|
|
273
273
|
</div>
|
data/doc/Mint/Registry.html
CHANGED
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
<div class="method_details first">
|
|
278
278
|
<h3 class="signature first" id="currencies-class_method">
|
|
279
279
|
|
|
280
|
-
.<strong>currencies</strong> ⇒ <tt>Hash{String => <span class='object_link'><a href="Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>
|
|
280
|
+
.<strong>currencies</strong> ⇒ <tt>Hash{<span class='object_link'><a href="../String.html" title="String (class)">String</a></span> => <span class='object_link'><a href="Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>
|
|
281
281
|
|
|
282
282
|
|
|
283
283
|
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
<li>
|
|
302
302
|
|
|
303
303
|
|
|
304
|
-
<span class='type'>(<tt>Hash{String => <span class='object_link'><a href="Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>)</span>
|
|
304
|
+
<span class='type'>(<tt>Hash{<span class='object_link'><a href="../String.html" title="String (class)">String</a></span> => <span class='object_link'><a href="Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>)</span>
|
|
305
305
|
|
|
306
306
|
|
|
307
307
|
|
|
@@ -357,7 +357,7 @@
|
|
|
357
357
|
<span class='name'>code</span>
|
|
358
358
|
|
|
359
359
|
|
|
360
|
-
<span class='type'>(<tt>String</tt>)</span>
|
|
360
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
|
361
361
|
|
|
362
362
|
|
|
363
363
|
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
<span class='name'>symbol</span>
|
|
388
388
|
|
|
389
389
|
|
|
390
|
-
<span class='type'>(<tt>String</tt>)</span>
|
|
390
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
|
391
391
|
|
|
392
392
|
|
|
393
393
|
<em class="default">(defaults to: <tt>''</tt>)</em>
|
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
<pre class="code"><span class="info file"># File 'lib/minting/mint/registry/registration.rb', line 15</span>
|
|
490
490
|
|
|
491
491
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_register'>register</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>
|
|
492
|
-
<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 code must be String</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span>
|
|
492
|
+
<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 code must be String</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></span>
|
|
493
493
|
<span class='kw'>unless</span> <span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[A-Z_]+$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
|
|
494
494
|
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span>
|
|
495
495
|
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Currency code must have only letters or '_' ('USD',, 'MY_COIN')</span><span class='tstring_end'>"</span></span>
|
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
<div class="method_details ">
|
|
514
514
|
<h3 class="signature " id="world_currencies-class_method">
|
|
515
515
|
|
|
516
|
-
.<strong>world_currencies</strong> ⇒ <tt>Hash{String => <span class='object_link'><a href="Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>
|
|
516
|
+
.<strong>world_currencies</strong> ⇒ <tt>Hash{<span class='object_link'><a href="../String.html" title="String (class)">String</a></span> => <span class='object_link'><a href="Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>
|
|
517
517
|
|
|
518
518
|
|
|
519
519
|
|
|
@@ -537,7 +537,7 @@
|
|
|
537
537
|
<li>
|
|
538
538
|
|
|
539
539
|
|
|
540
|
-
<span class='type'>(<tt>Hash{String => <span class='object_link'><a href="Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>)</span>
|
|
540
|
+
<span class='type'>(<tt>Hash{<span class='object_link'><a href="../String.html" title="String (class)">String</a></span> => <span class='object_link'><a href="Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>)</span>
|
|
541
541
|
|
|
542
542
|
|
|
543
543
|
|
|
@@ -717,7 +717,7 @@
|
|
|
717
717
|
<span class='name'>symbol</span>
|
|
718
718
|
|
|
719
719
|
|
|
720
|
-
<span class='type'>(<tt>String</tt>)</span>
|
|
720
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
|
721
721
|
|
|
722
722
|
|
|
723
723
|
|
|
@@ -796,7 +796,7 @@
|
|
|
796
796
|
<span class='name'>input</span>
|
|
797
797
|
|
|
798
798
|
|
|
799
|
-
<span class='type'>(<tt>String</tt>)</span>
|
|
799
|
+
<span class='type'>(<tt><span class='object_link'><a href="../String.html" title="String (class)">String</a></span></tt>)</span>
|
|
800
800
|
|
|
801
801
|
|
|
802
802
|
|
|
@@ -853,7 +853,7 @@
|
|
|
853
853
|
</div>
|
|
854
854
|
|
|
855
855
|
<div id="footer">
|
|
856
|
-
Generated on
|
|
856
|
+
Generated on Wed Jul 1 01:11:53 2026 by
|
|
857
857
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
858
858
|
0.9.44 (ruby-4.0.5).
|
|
859
859
|
</div>
|
data/doc/Mint/Rounding.html
CHANGED
|
@@ -268,7 +268,7 @@ Uses the fast path (+to_r.round+) when no custom mode is active.</p>
|
|
|
268
268
|
<span class='name'>amount</span>
|
|
269
269
|
|
|
270
270
|
|
|
271
|
-
<span class='type'>(<tt>Numeric</tt>)</span>
|
|
271
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Numeric.html" title="Numeric (class)">Numeric</a></span></tt>)</span>
|
|
272
272
|
|
|
273
273
|
|
|
274
274
|
|
|
@@ -496,7 +496,7 @@ previous mode on exit (even on exception).</p>
|
|
|
496
496
|
</div>
|
|
497
497
|
|
|
498
498
|
<div id="footer">
|
|
499
|
-
Generated on
|
|
499
|
+
Generated on Wed Jul 1 01:11:52 2026 by
|
|
500
500
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
501
501
|
0.9.44 (ruby-4.0.5).
|
|
502
502
|
</div>
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
<dl>
|
|
72
72
|
<dt>Inherits:</dt>
|
|
73
73
|
<dd>
|
|
74
|
-
<span class="inheritName">
|
|
74
|
+
<span class="inheritName">ArgumentError</span>
|
|
75
75
|
|
|
76
76
|
<ul class="fullTree">
|
|
77
77
|
<li>Object</li>
|
|
78
78
|
|
|
79
|
-
<li class="next">
|
|
79
|
+
<li class="next">ArgumentError</li>
|
|
80
80
|
|
|
81
81
|
<li class="next">Mint::UnknownCurrency</li>
|
|
82
82
|
|
|
@@ -106,7 +106,9 @@
|
|
|
106
106
|
|
|
107
107
|
<h2>Overview</h2><div class="docstring">
|
|
108
108
|
<div class="discussion">
|
|
109
|
-
<p>
|
|
109
|
+
<p>Raised when a currency cannot be resolved from a code or object.</p>
|
|
110
|
+
<p>Inherits from <code>ArgumentError</code> so existing <code>rescue ArgumentError</code> handlers
|
|
111
|
+
continue to work; rescue <code>Mint::UnknownCurrency</code> for the specific case.</p>
|
|
110
112
|
|
|
111
113
|
</div>
|
|
112
114
|
</div>
|
|
@@ -126,7 +128,7 @@
|
|
|
126
128
|
</div>
|
|
127
129
|
|
|
128
130
|
<div id="footer">
|
|
129
|
-
Generated on
|
|
131
|
+
Generated on Wed Jul 1 01:11:53 2026 by
|
|
130
132
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
131
133
|
0.9.44 (ruby-4.0.5).
|
|
132
134
|
</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/i18n.rb<span class="defines">,<br>
|
|
94
|
-
lib/minting/mint/mint.rb,<br> lib/minting/money/clamp.rb,<br> lib/minting/money/money.rb,<br> lib/minting/mint/rounding.rb,<br> lib/minting/mint/dsl/range.rb,<br> lib/minting/money/coercion.rb,<br> lib/minting/
|
|
94
|
+
lib/minting/mint/mint.rb,<br> lib/minting/money/clamp.rb,<br> lib/minting/money/money.rb,<br> lib/minting/mint/rounding.rb,<br> lib/minting/mint/dsl/range.rb,<br> lib/minting/money/coercion.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/parser/parser.rb,<br> lib/minting/money/constructors.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>
|
|
@@ -189,28 +189,6 @@
|
|
|
189
189
|
<li class="public ">
|
|
190
190
|
<span class="summary_signature">
|
|
191
191
|
|
|
192
|
-
<a href="#use_top_level_constants!-class_method" title="use_top_level_constants! (class method)">.<strong>use_top_level_constants!</strong> ⇒ Object </a>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
</span>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
<span class="summary_desc"><div class='inline'><p>Registers top-level ::Money and ::Currency constants as aliases for Mint's classes.</p></div></span>
|
|
207
|
-
|
|
208
|
-
</li>
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<li class="public ">
|
|
212
|
-
<span class="summary_signature">
|
|
213
|
-
|
|
214
192
|
<a href="#with_rounding-class_method" title="with_rounding (class method)">.<strong>with_rounding</strong>(mode) { ... } ⇒ Object </a>
|
|
215
193
|
|
|
216
194
|
|
|
@@ -333,7 +311,7 @@
|
|
|
333
311
|
[+:thousand+] Thousands delimiter (e.g. +"."+)
|
|
334
312
|
[+:format+] Format template string (e.g. +"%<amount>f %<symbol>s"+)
|
|
335
313
|
</code></pre>
|
|
336
|
-
<p>When set, <code>#
|
|
314
|
+
<p>When set, <code>#to_formatted_s</code> and <code>#format</code> use these values as fallbacks when the
|
|
337
315
|
corresponding parameter is not explicitly provided.</p>
|
|
338
316
|
|
|
339
317
|
</div>
|
|
@@ -344,7 +322,7 @@ corresponding parameter is not explicitly provided.</p>
|
|
|
344
322
|
<h4 class="tag_title">Examples:</h4>
|
|
345
323
|
|
|
346
324
|
|
|
347
|
-
<h5 class="example_title"><div class='inline'><p>Rails I18n integration (in
|
|
325
|
+
<h5 class="example_title"><div class='inline'><p>Rails I18n integration (in attribute-money railtie)</p></div></h5>
|
|
348
326
|
|
|
349
327
|
<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>
|
|
350
328
|
<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>
|
|
@@ -423,7 +401,7 @@ corresponding parameter is not explicitly provided.</p>
|
|
|
423
401
|
<span class='name'>amount</span>
|
|
424
402
|
|
|
425
403
|
|
|
426
|
-
<span class='type'>(<tt>Numeric</tt>)</span>
|
|
404
|
+
<span class='type'>(<tt><span class='object_link'><a href="Numeric.html" title="Numeric (class)">Numeric</a></span></tt>)</span>
|
|
427
405
|
|
|
428
406
|
|
|
429
407
|
|
|
@@ -437,12 +415,15 @@ corresponding parameter is not explicitly provided.</p>
|
|
|
437
415
|
<span class='name'>currency_code</span>
|
|
438
416
|
|
|
439
417
|
|
|
440
|
-
<span class='type'>(<tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt>, <tt>
|
|
418
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>, <tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt>, <tt><span class='object_link'><a href="Mint/Money.html" title="Mint::Money (class)">Money</a></span></tt>, <tt>nil</tt>)</span>
|
|
441
419
|
|
|
442
420
|
|
|
443
421
|
|
|
444
422
|
—
|
|
445
|
-
<div class='inline'><p>Currency code
|
|
423
|
+
<div class='inline'><p>Currency code, object,
|
|
424
|
+
Money whose currency to reuse, or <code>nil</code>. Passed through
|
|
425
|
+
<span class='object_link'><a href="Mint/Currency.html#resolve!-class_method" title="Mint::Currency.resolve! (method)">Mint::Currency.resolve!</a></span> so all accepted types resolve to a registered
|
|
426
|
+
currency.</p></div>
|
|
446
427
|
|
|
447
428
|
</li>
|
|
448
429
|
|
|
@@ -475,58 +456,20 @@ corresponding parameter is not explicitly provided.</p>
|
|
|
475
456
|
|
|
476
457
|
|
|
477
458
|
—
|
|
478
|
-
<div class='inline'><p>if the
|
|
459
|
+
<div class='inline'><p>if the amount is not a Numeric</p></div>
|
|
479
460
|
|
|
480
461
|
</li>
|
|
481
462
|
|
|
482
|
-
</ul>
|
|
483
|
-
|
|
484
|
-
</div><table class="source_code">
|
|
485
|
-
<tr>
|
|
486
|
-
<td>
|
|
487
|
-
<pre class="lines">
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
15</pre>
|
|
491
|
-
</td>
|
|
492
|
-
<td>
|
|
493
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 15</span>
|
|
494
|
-
|
|
495
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_money'>money</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_currency_code'>currency_code</span><span class='rparen'>)</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Mint/Money.html" title="Mint::Money (class)">Money</a></span></span><span class='period'>.</span><span class='id identifier rubyid_from'><span class='object_link'><a href="Mint/Money.html#from-class_method" title="Mint::Money.from (method)">from</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_currency_code'>currency_code</span><span class='rparen'>)</span></pre>
|
|
496
|
-
</td>
|
|
497
|
-
</tr>
|
|
498
|
-
</table>
|
|
499
|
-
</div>
|
|
500
|
-
|
|
501
|
-
<div class="method_details ">
|
|
502
|
-
<h3 class="signature " id="use_top_level_constants!-class_method">
|
|
503
|
-
|
|
504
|
-
.<strong>use_top_level_constants!</strong> ⇒ <tt>Object</tt>
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
</h3><div class="docstring">
|
|
511
|
-
<div class="discussion">
|
|
512
|
-
<p>Registers top-level ::Money and ::Currency constants as aliases for Mint's classes.</p>
|
|
513
|
-
|
|
514
|
-
</div>
|
|
515
|
-
</div>
|
|
516
|
-
<div class="tags">
|
|
517
|
-
|
|
518
|
-
<p class="tag_title">Raises:</p>
|
|
519
|
-
<ul class="raise">
|
|
520
|
-
|
|
521
463
|
<li>
|
|
522
464
|
|
|
523
465
|
|
|
524
|
-
<span class='type'>(<tt>
|
|
466
|
+
<span class='type'>(<tt><span class='object_link'><a href="Mint/UnknownCurrency.html" title="Mint::UnknownCurrency (class)">Mint::UnknownCurrency</a></span></tt>)</span>
|
|
525
467
|
|
|
526
468
|
|
|
527
469
|
|
|
528
470
|
—
|
|
529
|
-
<div class='inline'><p>if
|
|
471
|
+
<div class='inline'><p>if the currency code is not registered.
|
|
472
|
+
<code>Mint::UnknownCurrency</code> inherits from <code>ArgumentError</code>.</p></div>
|
|
530
473
|
|
|
531
474
|
</li>
|
|
532
475
|
|
|
@@ -538,28 +481,12 @@ corresponding parameter is not explicitly provided.</p>
|
|
|
538
481
|
<pre class="lines">
|
|
539
482
|
|
|
540
483
|
|
|
541
|
-
|
|
542
|
-
9
|
|
543
|
-
10
|
|
544
|
-
11
|
|
545
|
-
12
|
|
546
|
-
13
|
|
547
|
-
14
|
|
548
|
-
15
|
|
549
|
-
16</pre>
|
|
484
|
+
23</pre>
|
|
550
485
|
</td>
|
|
551
486
|
<td>
|
|
552
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/
|
|
553
|
-
|
|
554
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier
|
|
555
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='kw'>defined?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#Money-constant" title="Money (constant)">Money</a></span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='kw'>defined?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#Currency-constant" title="Currency (constant)">Currency</a></span></span><span class='rparen'>)</span>
|
|
556
|
-
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>minting/mint/aliases</span><span class='tstring_end'>'</span></span>
|
|
557
|
-
<span class='kw'>elsif</span> <span class='op'>::</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#Money-constant" title="Money (constant)">Money</a></span></span> <span class='op'>==</span> <span class='const'><span class='object_link'><a href="" title="Mint (module)">Mint</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Mint/Money.html" title="Mint::Money (class)">Money</a></span></span> <span class='op'>&&</span> <span class='op'>::</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#Currency-constant" title="Currency (constant)">Currency</a></span></span> <span class='op'>==</span> <span class='const'><span class='object_link'><a href="" title="Mint (module)">Mint</a></span></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>
|
|
558
|
-
<span class='id identifier rubyid_warn'>warn</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Warning: Money and Currency already defined as Mint aliases, skipping</span><span class='tstring_end'>'</span></span>
|
|
559
|
-
<span class='kw'>else</span>
|
|
560
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NameError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Cannot define top-level Money or Currency constants: already defined</span><span class='tstring_end'>'</span></span>
|
|
561
|
-
<span class='kw'>end</span>
|
|
562
|
-
<span class='kw'>end</span></pre>
|
|
487
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 23</span>
|
|
488
|
+
|
|
489
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_money'>money</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_currency_code'>currency_code</span><span class='rparen'>)</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Mint/Money.html" title="Mint::Money (class)">Money</a></span></span><span class='period'>.</span><span class='id identifier rubyid_from'><span class='object_link'><a href="Mint/Money.html#from-class_method" title="Mint::Money.from (method)">from</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_currency_code'>currency_code</span><span class='rparen'>)</span></pre>
|
|
563
490
|
</td>
|
|
564
491
|
</tr>
|
|
565
492
|
</table>
|
|
@@ -648,13 +575,13 @@ the fast path incurs zero overhead.</p>
|
|
|
648
575
|
<pre class="lines">
|
|
649
576
|
|
|
650
577
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
578
|
+
45
|
|
579
|
+
46
|
|
580
|
+
47
|
|
581
|
+
48</pre>
|
|
655
582
|
</td>
|
|
656
583
|
<td>
|
|
657
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line
|
|
584
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 45</span>
|
|
658
585
|
|
|
659
586
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_with_rounding'>with_rounding</span><span class='lparen'>(</span><span class='id identifier rubyid_mode'>mode</span><span class='comma'>,</span> <span class='op'>&</span><span class='rparen'>)</span>
|
|
660
587
|
<span class='id identifier rubyid_require_relative'>require_relative</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rounding</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Mint (module)">Mint</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Mint/Rounding.html" title="Mint::Rounding (module)">Rounding</a></span></span><span class='rparen'>)</span>
|
|
@@ -668,7 +595,7 @@ the fast path incurs zero overhead.</p>
|
|
|
668
595
|
<div class="method_details ">
|
|
669
596
|
<h3 class="signature " id="world_currencies-class_method">
|
|
670
597
|
|
|
671
|
-
.<strong>world_currencies</strong> ⇒ <tt>Hash{String => <span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>
|
|
598
|
+
.<strong>world_currencies</strong> ⇒ <tt>Hash{<span class='object_link'><a href="String.html" title="String (class)">String</a></span> => <span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>
|
|
672
599
|
|
|
673
600
|
|
|
674
601
|
|
|
@@ -692,7 +619,7 @@ the fast path incurs zero overhead.</p>
|
|
|
692
619
|
<li>
|
|
693
620
|
|
|
694
621
|
|
|
695
|
-
<span class='type'>(<tt>Hash{String => <span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>)</span>
|
|
622
|
+
<span class='type'>(<tt>Hash{<span class='object_link'><a href="String.html" title="String (class)">String</a></span> => <span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span>}</tt>)</span>
|
|
696
623
|
|
|
697
624
|
|
|
698
625
|
|
|
@@ -709,10 +636,10 @@ the fast path incurs zero overhead.</p>
|
|
|
709
636
|
<pre class="lines">
|
|
710
637
|
|
|
711
638
|
|
|
712
|
-
|
|
639
|
+
27</pre>
|
|
713
640
|
</td>
|
|
714
641
|
<td>
|
|
715
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line
|
|
642
|
+
<pre class="code"><span class="info file"># File 'lib/minting/mint/mint.rb', line 27</span>
|
|
716
643
|
|
|
717
644
|
<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>
|
|
718
645
|
</td>
|
|
@@ -768,7 +695,7 @@ the fast path incurs zero overhead.</p>
|
|
|
768
695
|
<span class='name'>input</span>
|
|
769
696
|
|
|
770
697
|
|
|
771
|
-
<span class='type'>(<tt>String</tt>)</span>
|
|
698
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>)</span>
|
|
772
699
|
|
|
773
700
|
|
|
774
701
|
|
|
@@ -782,7 +709,7 @@ the fast path incurs zero overhead.</p>
|
|
|
782
709
|
<span class='name'>currency</span>
|
|
783
710
|
|
|
784
711
|
|
|
785
|
-
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>, <tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt>, <tt>nil</tt>)</span>
|
|
712
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>, <tt>Symbol</tt>, <tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt>, <tt>nil</tt>)</span>
|
|
786
713
|
|
|
787
714
|
|
|
788
715
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
@@ -835,7 +762,7 @@ the fast path incurs zero overhead.</p>
|
|
|
835
762
|
<pre class="code"><span class="info file"># File 'lib/minting/mint/parser/parser.rb', line 22</span>
|
|
836
763
|
|
|
837
764
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='comma'>,</span> <span class='id identifier rubyid_currency'>currency</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
838
|
-
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
765
|
+
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
|
|
839
766
|
|
|
840
767
|
<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>
|
|
841
768
|
<span class='kw'>return</span> <span class='kw'>nil</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,7 +814,7 @@ the fast path incurs zero overhead.</p>
|
|
|
887
814
|
<span class='name'>input</span>
|
|
888
815
|
|
|
889
816
|
|
|
890
|
-
<span class='type'>(<tt>String</tt>)</span>
|
|
817
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>)</span>
|
|
891
818
|
|
|
892
819
|
|
|
893
820
|
|
|
@@ -901,7 +828,7 @@ the fast path incurs zero overhead.</p>
|
|
|
901
828
|
<span class='name'>currency</span>
|
|
902
829
|
|
|
903
830
|
|
|
904
|
-
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>, <tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt>, <tt>nil</tt>)</span>
|
|
831
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="String (class)">String</a></span></tt>, <tt>Symbol</tt>, <tt><span class='object_link'><a href="Mint/Currency.html" title="Mint::Currency (class)">Currency</a></span></tt>, <tt>nil</tt>)</span>
|
|
905
832
|
|
|
906
833
|
|
|
907
834
|
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
@@ -970,7 +897,7 @@ the fast path incurs zero overhead.</p>
|
|
|
970
897
|
<pre class="code"><span class="info file"># File 'lib/minting/mint/parser/parser.rb', line 48</span>
|
|
971
898
|
|
|
972
899
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse!'>parse!</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='comma'>,</span> <span class='id identifier rubyid_currency'>currency</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
973
|
-
<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 must be a String</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
900
|
+
<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 must be a String</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_input'>input</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
|
|
974
901
|
|
|
975
902
|
<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>
|
|
976
903
|
<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>
|
|
@@ -994,7 +921,7 @@ the fast path incurs zero overhead.</p>
|
|
|
994
921
|
</div>
|
|
995
922
|
|
|
996
923
|
<div id="footer">
|
|
997
|
-
Generated on
|
|
924
|
+
Generated on Wed Jul 1 01:11:52 2026 by
|
|
998
925
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
999
926
|
0.9.44 (ruby-4.0.5).
|
|
1000
927
|
</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.
|
|
119
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.9.6</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 Wed Jul 1 01:11:52 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>
|