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
data/doc/Mint/Money.html
CHANGED
|
@@ -957,7 +957,7 @@ Uses <code>%<symbol>s</code> for the currency symbol and <code>%<amount
|
|
|
957
957
|
<li class="public ">
|
|
958
958
|
<span class="summary_signature">
|
|
959
959
|
|
|
960
|
-
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong>(format:
|
|
960
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong>(format: nil, decimal: nil, thousand: nil, width: nil) ⇒ String </a>
|
|
961
961
|
|
|
962
962
|
|
|
963
963
|
|
|
@@ -1033,12 +1033,12 @@ Uses <code>%<symbol>s</code> for the currency symbol and <code>%<amount
|
|
|
1033
1033
|
<pre class="lines">
|
|
1034
1034
|
|
|
1035
1035
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1036
|
+
22
|
|
1037
|
+
23
|
|
1038
|
+
24</pre>
|
|
1039
1039
|
</td>
|
|
1040
1040
|
<td>
|
|
1041
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line
|
|
1041
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line 22</span>
|
|
1042
1042
|
|
|
1043
1043
|
<span class='kw'>def</span> <span class='id identifier rubyid_amount'>amount</span>
|
|
1044
1044
|
<span class='ivar'>@amount</span>
|
|
@@ -1074,12 +1074,12 @@ Uses <code>%<symbol>s</code> for the currency symbol and <code>%<amount
|
|
|
1074
1074
|
<pre class="lines">
|
|
1075
1075
|
|
|
1076
1076
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1077
|
+
22
|
|
1078
|
+
23
|
|
1079
|
+
24</pre>
|
|
1080
1080
|
</td>
|
|
1081
1081
|
<td>
|
|
1082
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line
|
|
1082
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line 22</span>
|
|
1083
1083
|
|
|
1084
1084
|
<span class='kw'>def</span> <span class='id identifier rubyid_currency'>currency</span>
|
|
1085
1085
|
<span class='ivar'>@currency</span>
|
|
@@ -1183,10 +1183,10 @@ Uses <code>%<symbol>s</code> for the currency symbol and <code>%<amount
|
|
|
1183
1183
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span>
|
|
1184
1184
|
<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'>amount must be Numeric</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Numeric</span><span class='rparen'>)</span>
|
|
1185
1185
|
|
|
1186
|
-
<span class='id identifier
|
|
1187
|
-
<span class='id identifier
|
|
1186
|
+
<span class='id identifier rubyid_currency'>currency</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="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="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>
|
|
1187
|
+
<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_amount'>amount</span><span class='rparen'>)</span>
|
|
1188
1188
|
|
|
1189
|
-
<span class='id identifier
|
|
1189
|
+
<span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span> <span class='op'>?</span> <span class='const'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span><span class='period'>.</span><span class='id identifier rubyid_zero'><span class='object_link'><a href="../Mint.html#zero-class_method" title="Mint.zero (method)">zero</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_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span>
|
|
1190
1190
|
<span class='kw'>end</span></pre>
|
|
1191
1191
|
</td>
|
|
1192
1192
|
</tr>
|
|
@@ -1312,9 +1312,7 @@ is not registered</p></div>
|
|
|
1312
1312
|
40
|
|
1313
1313
|
41
|
|
1314
1314
|
42
|
|
1315
|
-
43
|
|
1316
|
-
44
|
|
1317
|
-
45</pre>
|
|
1315
|
+
43</pre>
|
|
1318
1316
|
</td>
|
|
1319
1317
|
<td>
|
|
1320
1318
|
<pre class="code"><span class="info file"># File 'lib/minting/money/constructors.rb', line 37</span>
|
|
@@ -1322,11 +1320,9 @@ is not registered</p></div>
|
|
|
1322
1320
|
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_fractional'>from_fractional</span><span class='lparen'>(</span><span class='id identifier rubyid_fractional'>fractional</span><span class='comma'>,</span> <span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span>
|
|
1323
1321
|
<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'>fractional must be an Integer</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_fractional'>fractional</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
|
|
1324
1322
|
|
|
1325
|
-
<span class='id identifier
|
|
1326
|
-
<span class='id identifier
|
|
1327
|
-
|
|
1328
|
-
<span class='id identifier rubyid_amount'>amount</span> <span class='op'>=</span> <span class='const'>Rational</span><span class='lparen'>(</span><span class='id identifier rubyid_fractional'>fractional</span><span class='comma'>,</span> <span class='id identifier rubyid_checked_currency'>checked_currency</span><span class='period'>.</span><span class='id identifier rubyid_fractional_multiplier'>fractional_multiplier</span><span class='rparen'>)</span>
|
|
1329
|
-
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_checked_currency'>checked_currency</span><span class='rparen'>)</span>
|
|
1323
|
+
<span class='id identifier rubyid_currency'>currency</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="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="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>
|
|
1324
|
+
<span class='id identifier rubyid_amount'>amount</span> <span class='op'>=</span> <span class='const'>Rational</span><span class='lparen'>(</span><span class='id identifier rubyid_fractional'>fractional</span><span class='comma'>,</span> <span class='id identifier rubyid_currency'>currency</span><span class='period'>.</span><span class='id identifier rubyid_fractional_multiplier'>fractional_multiplier</span><span class='rparen'>)</span>
|
|
1325
|
+
<span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span> <span class='op'>?</span> <span class='const'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span><span class='period'>.</span><span class='id identifier rubyid_zero'><span class='object_link'><a href="../Mint.html#zero-class_method" title="Mint.zero (method)">zero</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_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span>
|
|
1330
1326
|
<span class='kw'>end</span></pre>
|
|
1331
1327
|
</td>
|
|
1332
1328
|
</tr>
|
|
@@ -2460,10 +2456,10 @@ This enables expressions like <code>5 * money</code> where <code>5</code> is a N
|
|
|
2460
2456
|
<pre class="lines">
|
|
2461
2457
|
|
|
2462
2458
|
|
|
2463
|
-
|
|
2459
|
+
29</pre>
|
|
2464
2460
|
</td>
|
|
2465
2461
|
<td>
|
|
2466
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line
|
|
2462
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line 29</span>
|
|
2467
2463
|
|
|
2468
2464
|
<span class='kw'>def</span> <span class='id identifier rubyid_currency_code'>currency_code</span> <span class='op'>=</span> <span class='id identifier rubyid_currency'>currency</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span></pre>
|
|
2469
2465
|
</td>
|
|
@@ -2579,10 +2575,10 @@ For example, cents for USD (subunit 2), yen for JPY (subunit 0), fils for IQD (s
|
|
|
2579
2575
|
<pre class="lines">
|
|
2580
2576
|
|
|
2581
2577
|
|
|
2582
|
-
|
|
2578
|
+
39</pre>
|
|
2583
2579
|
</td>
|
|
2584
2580
|
<td>
|
|
2585
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line
|
|
2581
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line 39</span>
|
|
2586
2582
|
|
|
2587
2583
|
<span class='kw'>def</span> <span class='id identifier rubyid_fractional'>fractional</span> <span class='op'>=</span> <span class='lparen'>(</span><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_fractional_multiplier'>fractional_multiplier</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span></pre>
|
|
2588
2584
|
</td>
|
|
@@ -2630,10 +2626,10 @@ For example, cents for USD (subunit 2), yen for JPY (subunit 0), fils for IQD (s
|
|
|
2630
2626
|
<pre class="lines">
|
|
2631
2627
|
|
|
2632
2628
|
|
|
2633
|
-
|
|
2629
|
+
44</pre>
|
|
2634
2630
|
</td>
|
|
2635
2631
|
<td>
|
|
2636
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line
|
|
2632
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line 44</span>
|
|
2637
2633
|
|
|
2638
2634
|
<span class='kw'>def</span> <span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='lbracket'>[</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='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_hash'>hash</span></pre>
|
|
2639
2635
|
</td>
|
|
@@ -2681,12 +2677,12 @@ For example, cents for USD (subunit 2), yen for JPY (subunit 0), fils for IQD (s
|
|
|
2681
2677
|
<pre class="lines">
|
|
2682
2678
|
|
|
2683
2679
|
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2680
|
+
49
|
|
2681
|
+
50
|
|
2682
|
+
51</pre>
|
|
2687
2683
|
</td>
|
|
2688
2684
|
<td>
|
|
2689
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line
|
|
2685
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line 49</span>
|
|
2690
2686
|
|
|
2691
2687
|
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
|
|
2692
2688
|
<span class='const'>Kernel</span><span class='period'>.</span><span class='id identifier rubyid_format'>format</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_currency_code'>currency_code</span><span class='embexpr_end'>}</span><span class='tstring_content'> %0.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_currency'>currency</span><span class='period'>.</span><span class='id identifier rubyid_subunit'>subunit</span><span class='embexpr_end'>}</span><span class='tstring_content'>f]</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_amount'>amount</span>
|
|
@@ -2766,17 +2762,31 @@ while preserving immutability.</p>
|
|
|
2766
2762
|
<pre class="lines">
|
|
2767
2763
|
|
|
2768
2764
|
|
|
2765
|
+
55
|
|
2766
|
+
56
|
|
2769
2767
|
57
|
|
2770
2768
|
58
|
|
2771
2769
|
59
|
|
2772
|
-
60
|
|
2770
|
+
60
|
|
2771
|
+
61
|
|
2772
|
+
62
|
|
2773
|
+
63
|
|
2774
|
+
64
|
|
2775
|
+
65</pre>
|
|
2773
2776
|
</td>
|
|
2774
2777
|
<td>
|
|
2775
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/constructors.rb', line
|
|
2778
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/constructors.rb', line 55</span>
|
|
2776
2779
|
|
|
2777
2780
|
<span class='kw'>def</span> <span class='id identifier rubyid_mint'>mint</span><span class='lparen'>(</span><span class='id identifier rubyid_new_amount'>new_amount</span><span class='rparen'>)</span>
|
|
2778
2781
|
<span class='id identifier rubyid_new_amount'>new_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_new_amount'>new_amount</span><span class='rparen'>)</span>
|
|
2779
|
-
|
|
2782
|
+
|
|
2783
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_new_amount'>new_amount</span> <span class='op'>==</span> <span class='id identifier rubyid_amount'>amount</span>
|
|
2784
|
+
<span class='kw'>self</span>
|
|
2785
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_new_amount'>new_amount</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
|
|
2786
|
+
<span class='const'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span><span class='period'>.</span><span class='id identifier rubyid_zero'><span class='object_link'><a href="../Mint.html#zero-class_method" title="Mint.zero (method)">zero</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span>
|
|
2787
|
+
<span class='kw'>else</span>
|
|
2788
|
+
<span class='const'><span class='object_link'><a href="" title="Mint::Money (class)">Money</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_new_amount'>new_amount</span><span class='comma'>,</span> <span class='id identifier rubyid_currency'>currency</span><span class='rparen'>)</span>
|
|
2789
|
+
<span class='kw'>end</span>
|
|
2780
2790
|
<span class='kw'>end</span></pre>
|
|
2781
2791
|
</td>
|
|
2782
2792
|
</tr>
|
|
@@ -2994,10 +3004,10 @@ while preserving immutability.</p>
|
|
|
2994
3004
|
<pre class="lines">
|
|
2995
3005
|
|
|
2996
3006
|
|
|
2997
|
-
|
|
3007
|
+
57</pre>
|
|
2998
3008
|
</td>
|
|
2999
3009
|
<td>
|
|
3000
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line
|
|
3010
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/money.rb', line 57</span>
|
|
3001
3011
|
|
|
3002
3012
|
<span class='kw'>def</span> <span class='id identifier rubyid_same_currency?'>same_currency?</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span> <span class='op'>=</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_currency'>currency</span> <span class='op'>==</span> <span class='id identifier rubyid_currency'>currency</span></pre>
|
|
3003
3013
|
</td>
|
|
@@ -3596,7 +3606,7 @@ Highly optimized to run without external dependencies.</p>
|
|
|
3596
3606
|
<div class="method_details ">
|
|
3597
3607
|
<h3 class="signature " id="to_s-instance_method">
|
|
3598
3608
|
|
|
3599
|
-
#<strong>to_s</strong>(format:
|
|
3609
|
+
#<strong>to_s</strong>(format: nil, decimal: nil, thousand: nil, width: nil) ⇒ <tt>String</tt>
|
|
3600
3610
|
|
|
3601
3611
|
|
|
3602
3612
|
|
|
@@ -3642,6 +3652,11 @@ Highly optimized to run without external dependencies.</p>
|
|
|
3642
3652
|
<pre class="example code"><code><span class='id identifier rubyid_money'>money</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%<amount>10.2f</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='comment'>#=> " 1234.56"
|
|
3643
3653
|
</span><span class='id identifier rubyid_money'>money</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%<symbol>s%<amount>010.2f</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='comment'>#=> "$0001234.56"</span></code></pre>
|
|
3644
3654
|
|
|
3655
|
+
|
|
3656
|
+
<h5 class="example_title"><div class='inline'><p>Locale-aware formatting (with Mint.locale_backend set)</p></div></h5>
|
|
3657
|
+
|
|
3658
|
+
<pre class="example code"><code><span class='id identifier rubyid_money'>money</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='comment'># decimal and thousand come from locale_backend</span></code></pre>
|
|
3659
|
+
|
|
3645
3660
|
</div>
|
|
3646
3661
|
<p class="tag_title">Parameters:</p>
|
|
3647
3662
|
<ul class="param">
|
|
@@ -3651,10 +3666,10 @@ Highly optimized to run without external dependencies.</p>
|
|
|
3651
3666
|
<span class='name'>format</span>
|
|
3652
3667
|
|
|
3653
3668
|
|
|
3654
|
-
<span class='type'>(<tt>String</tt>, <tt>Hash</tt>)</span>
|
|
3669
|
+
<span class='type'>(<tt>String</tt>, <tt>Hash</tt>, <tt>nil</tt>)</span>
|
|
3655
3670
|
|
|
3656
3671
|
|
|
3657
|
-
<em class="default">(defaults to: <tt
|
|
3672
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
3658
3673
|
|
|
3659
3674
|
|
|
3660
3675
|
—
|
|
@@ -3666,7 +3681,9 @@ is convenient for sign-aware formats such as accounting parentheses:</p>
|
|
|
3666
3681
|
</code></pre>
|
|
3667
3682
|
<p>Missing keys fall back to the module default, so a Hash with only
|
|
3668
3683
|
:negative will still format positives sensibly. The valid keys are
|
|
3669
|
-
:positive, :negative, :zero; anything else raises ArgumentError
|
|
3684
|
+
:positive, :negative, :zero; anything else raises ArgumentError.
|
|
3685
|
+
When <code>nil</code>, falls back to <code>Mint.locale_backend</code> if set, otherwise
|
|
3686
|
+
<code>"%<symbol>s%<amount>f"</code>.</p></div>
|
|
3670
3687
|
|
|
3671
3688
|
</li>
|
|
3672
3689
|
|
|
@@ -3675,14 +3692,15 @@ is convenient for sign-aware formats such as accounting parentheses:</p>
|
|
|
3675
3692
|
<span class='name'>thousand</span>
|
|
3676
3693
|
|
|
3677
3694
|
|
|
3678
|
-
<span class='type'>(<tt>String</tt>, <tt>false</tt>)</span>
|
|
3695
|
+
<span class='type'>(<tt>String</tt>, <tt>false</tt>, <tt>nil</tt>)</span>
|
|
3679
3696
|
|
|
3680
3697
|
|
|
3681
|
-
<em class="default">(defaults to: <tt
|
|
3698
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
3682
3699
|
|
|
3683
3700
|
|
|
3684
3701
|
—
|
|
3685
|
-
<div class='inline'><p>Thousands delimiter (e.g., ',' for 1,000)
|
|
3702
|
+
<div class='inline'><p>Thousands delimiter (e.g., ',' for 1,000).
|
|
3703
|
+
When <code>nil</code>, falls back to <code>Mint.locale_backend</code> if set, otherwise <code>","</code>.</p></div>
|
|
3686
3704
|
|
|
3687
3705
|
</li>
|
|
3688
3706
|
|
|
@@ -3691,14 +3709,15 @@ is convenient for sign-aware formats such as accounting parentheses:</p>
|
|
|
3691
3709
|
<span class='name'>decimal</span>
|
|
3692
3710
|
|
|
3693
3711
|
|
|
3694
|
-
<span class='type'>(<tt>String</tt>)</span>
|
|
3712
|
+
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
|
|
3695
3713
|
|
|
3696
3714
|
|
|
3697
|
-
<em class="default">(defaults to: <tt
|
|
3715
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
3698
3716
|
|
|
3699
3717
|
|
|
3700
3718
|
—
|
|
3701
|
-
<div class='inline'><p>Decimal separator (e.g., '.' or ',')
|
|
3719
|
+
<div class='inline'><p>Decimal separator (e.g., '.' or ',').
|
|
3720
|
+
When <code>nil</code>, falls back to <code>Mint.locale_backend</code> if set, otherwise <code>"."</code>.</p></div>
|
|
3702
3721
|
|
|
3703
3722
|
</li>
|
|
3704
3723
|
|
|
@@ -3744,13 +3763,6 @@ is empty, or the Hash contains an unrecognised key.</p></div>
|
|
|
3744
3763
|
<pre class="lines">
|
|
3745
3764
|
|
|
3746
3765
|
|
|
3747
|
-
46
|
|
3748
|
-
47
|
|
3749
|
-
48
|
|
3750
|
-
49
|
|
3751
|
-
50
|
|
3752
|
-
51
|
|
3753
|
-
52
|
|
3754
3766
|
53
|
|
3755
3767
|
54
|
|
3756
3768
|
55
|
|
@@ -3763,12 +3775,23 @@ is empty, or the Hash contains an unrecognised key.</p></div>
|
|
|
3763
3775
|
62
|
|
3764
3776
|
63
|
|
3765
3777
|
64
|
|
3766
|
-
65
|
|
3778
|
+
65
|
|
3779
|
+
66
|
|
3780
|
+
67
|
|
3781
|
+
68
|
|
3782
|
+
69
|
|
3783
|
+
70
|
|
3784
|
+
71
|
|
3785
|
+
72
|
|
3786
|
+
73
|
|
3787
|
+
74</pre>
|
|
3767
3788
|
</td>
|
|
3768
3789
|
<td>
|
|
3769
|
-
<pre class="code"><span class="info file"># File 'lib/minting/money/format/to_s.rb', line
|
|
3790
|
+
<pre class="code"><span class="info file"># File 'lib/minting/money/format/to_s.rb', line 53</span>
|
|
3791
|
+
|
|
3792
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='label'>format:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>decimal:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>thousand:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>width:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
3793
|
+
<span class='id identifier rubyid_format'>format</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal'>decimal</span><span class='comma'>,</span> <span class='id identifier rubyid_thousand'>thousand</span> <span class='op'>=</span> <span class='id identifier rubyid_resolve_locale_for'>resolve_locale_for</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal'>decimal</span><span class='comma'>,</span> <span class='id identifier rubyid_thousand'>thousand</span><span class='rparen'>)</span>
|
|
3770
3794
|
|
|
3771
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%<symbol>s%<amount>f</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>decimal:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>thousand:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>,</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>width:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
3772
3795
|
<span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span>
|
|
3773
3796
|
<span class='kw'>when</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span> <span class='kw'>then</span> <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'>format must not be empty</span><span class='tstring_end'>'</span></span>
|
|
3774
3797
|
<span class='kw'>when</span> <span class='const'>Hash</span> <span class='kw'>then</span> <span class='id identifier rubyid_validate_format_hash'>validate_format_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span>
|
|
@@ -3849,7 +3872,7 @@ is empty, or the Hash contains an unrecognised key.</p></div>
|
|
|
3849
3872
|
</div>
|
|
3850
3873
|
|
|
3851
3874
|
<div id="footer">
|
|
3852
|
-
Generated on
|
|
3875
|
+
Generated on Mon Jun 15 19:57:57 2026 by
|
|
3853
3876
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
3854
3877
|
0.9.44 (ruby-4.0.5).
|
|
3855
3878
|
</div>
|
|
@@ -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 Mon Jun 15 19:57:57 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>
|