minting 1.8.2 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 531ae60785c01288f3c5b6ffe222c86582c49e368770e8ac1dc89bfae675f279
4
- data.tar.gz: 3fd0d185d01ed315ea0bd5e89f8c923d5d1712ec571041cd678a7749fbf3ab44
3
+ metadata.gz: 84b163ccea567387ace107bbb07ff1089217eade0bccc9b5272f53727c302220
4
+ data.tar.gz: 646e33a6fe8cdb75e6b50cee77954413f9e074788fbc316eb08cba3f4d9d6591
5
5
  SHA512:
6
- metadata.gz: e0799f5c93aac8f065d1b213e848d4ec650278b93e475431ca7c6f71cc69cece2525c51fa4b7d2a54e6317f27befb68cfbf362b3c74960ce51a962cd0178d86c
7
- data.tar.gz: ae2121c6b9d7115b3ef40dbef4761ac0257cfea1770141543c87c741c0c49f8e5d60ef95970042dffe895ec948cc5c1dbf6ccf644aa34f401407003303c10744
6
+ metadata.gz: 9813ca14235c64e1893ec13dbd2b911450ab034084f93fbd02a19cac6d6c9b94e1e43c718724b6557b08f8a11bae855ae51f082c59b76432e60a9e069d075d2f
7
+ data.tar.gz: 9f56372568a9b0004115181abd47ab2efc0ffc35723bf1037a579ce5830cb88ed0bd10d5bf17a65b26bc323697d38944b997eafc33bae6b6b94c7e238499ec09
data/README.md CHANGED
@@ -5,7 +5,6 @@ Fast, precise, and developer-friendly money handling for Ruby.
5
5
  [![Gem Version](https://badge.fury.io/rb/minting.svg)](https://badge.fury.io/rb/minting)
6
6
  [![CI](https://github.com/gferraz/minting/actions/workflows/ci.yml/badge.svg)](https://github.com/gferraz/minting/actions/workflows/ci.yml)
7
7
  [![Test Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/gferraz/minting)
8
- [![RubyCritic](https://img.shields.io/badge/RubyCritic-94gem /100-brightgreen)](https://github.com/gferraz/minting)
9
8
  [![Documentation](https://img.shields.io/badge/docs-rubydoc.info-blue)](https://www.rubydoc.info/gems/minting/frames)
10
9
 
11
10
  ## Quick start
@@ -25,7 +24,7 @@ total.currency_code #=> "USD"
25
24
  Amounts are stored as `Rational` and rounded to the currency subunit. No floating-point surprises, ever.
26
25
 
27
26
  ### Blazing performance
28
- Minting is faster than the Money gem for everyday operations and **over 10× faster for formatting**. See full benchmarks in the [Performance Guide](test/performance/README.md).
27
+ Minting is faster than the Money gem for everyday operations and **over 10× faster for formatting**. See full benchmarks in the [Performance Guide](test/performance/BENCHMARKS.md).
29
28
 
30
29
  ### Clean, modern API
31
30
  Intuitive interface, descriptive error messages, and sensible defaults. Works the way you expect.
@@ -35,7 +34,7 @@ Use with the [minting-rails](https://github.com/gferraz/minting-rails) companion
35
34
 
36
35
  ### Quality code
37
36
  - **100% test coverage** — every line exercised
38
- - **93/100 RubyCritic score** — clean, maintainable code
37
+ - **94/100 RubyCritic score** — clean, maintainable code
39
38
  - **CI-tested on Ruby 3.3 and 4.0**
40
39
 
41
40
  ## Installation
@@ -81,7 +80,19 @@ Mint.money(10, 'USD') == 10 #=> false
81
80
 
82
81
  # Format (uses Kernel.format syntax)
83
82
  price = Mint.money(9.99, 'USD')
83
+ loss = Mint.money(-1234.56, 'USD')
84
84
 
85
+ # Built-in named presets
86
+ loss.to_s(:accounting) #=> "($1,234.56)"
87
+ Mint.money(1234.56, 'EUR').to_s(:european) #=> "1.234,56 €"
88
+ price.to_s(:amount) #=> "9.99"
89
+ price.to_s(:currency) #=> "USD 9.99"
90
+
91
+ # Presets can be overridden with explicit kwargs
92
+ Mint.money(1234.56, 'EUR').to_s(:european, format: '%<amount>f %<currency>s')
93
+ #=> "1.234,56 EUR"
94
+
95
+ # Or use direct format strings
85
96
  price.to_s #=> "$9.99",
86
97
  price.to_s(format: '%<amount>d') #=> "9",
87
98
  price.to_s(format: '%<symbol>s%<amount>f') #=> "$9.99",
@@ -97,6 +108,11 @@ price.to_s(format: ' %<amount>10f %<currency>s') #=> " 9.99 USD"
97
108
 
98
109
  price_in_euros.to_s(format: '%<symbol>2s%<amount>+10f') #=> " € +12.34"
99
110
 
111
+ # Integral & fractional parts
112
+ price.to_s(format: '%<integral>d %<fractional>d/100') #=> "9 99/100"
113
+ Mint.money(0.99, 'USD').to_s(format: '%<integral>d dollars and %<fractional>02d cents')
114
+ #=> "0 dollars and 99 cents"
115
+
100
116
  # Per-sign Hash format (e.g. accounting parentheses for losses)
101
117
  loss = Mint.money(-1234.56, 'USD')
102
118
  loss.to_s(format: { negative: '(%<symbol>s%<amount>f)' }) #=> "($1,234.56)"
@@ -116,9 +132,9 @@ price.to_hash #=> {currency: "USD", amount: "9.99"}
116
132
 
117
133
  # Fractional units (inverse of #fractional) - exact integer arithmetic
118
134
 
119
- price.fractional #=> 999
120
- Mint::Money.from_fractional(999, 'USD') #=> [USD 9.99]
121
- Mint::Money.from_fractional(1234, 'JPY') #=> [JPY 1234] # subunit 0 -> no scaling
135
+ price.subunits #=> 999
136
+ Mint::Money.from_subunits(999, 'USD') #=> [USD 9.99]
137
+ Mint::Money.from_subunits(1234, 'JPY') #=> [JPY 1234] # subunit 0 -> no scaling
122
138
 
123
139
 
124
140
  # No currency (ISO 4217 XXX)
@@ -164,7 +180,7 @@ Notes:
164
180
  - Pass a currency code when the string has no symbol or code.
165
181
  - `1,234` means 1234, not 1.234 and `1,23` means 1.23, not 123
166
182
  - `1,234.00` is unambiguous (thousands + decimal).
167
- - Accounting negatives like `($1.23)` are unsupported for now.
183
+ - Accounting negatives like `($1.23)` or `(USD 10.00)` are supported the parser detects parentheses and negates the amount.
168
184
  - Ambiguous symbols like `$` resolve by currency priority (currently USD).
169
185
  - The parser scans all uppercase words for registered codes, so spurious non-currency words before the real code are correctly ignored: `Mint.parse("MAX 10.00 USD")` yields `[USD 10.00]`.
170
186
 
@@ -195,6 +211,8 @@ Mint.with_rounding(:floor) { Mint.parse('1.009', 'USD') } #=> [USD 1.00]
195
211
 
196
212
  Modes: `:half_up` (default), `:half_down`, `:floor`, `:ceil`, `:truncate`, `:down`. Applies to construction, parsing, `change`, `split`, and `allocate`. Restores the previous mode when the block exits, even on exception.
197
213
 
214
+ > **Performance note:** Rounding-mode support is not loaded by default — `require 'minting'` uses the fastest possible rounding (equivalent to `:half_up`) with zero dispatch overhead. The first call to `Mint.with_rounding` loads the rounding module and patches `Currency#normalize_amount`, adding ~10–35 ns per money creation or mutation. If your application never uses custom rounding modes (the common case), there is **no performance cost**.
215
+
198
216
  **Refinements** — `10.dollars` and similar helpers require `using Mint` in the current scope (see Usage above).
199
217
 
200
218
  **Division** — `money / 5` returns new `Money`; `money / other_money` returns a numeric ratio, not money.
@@ -203,7 +221,7 @@ Modes: `:half_up` (default), `:half_down`, `:floor`, `:ceil`, `:truncate`, `:dow
203
221
 
204
222
  **Zero helper** — `Currency.zero('USD')` returns a frozen zero-Money, useful as a default value for discounts, totals, or counters.
205
223
 
206
- **Registered currencies** — `Currency.register(code:, subunit:, symbol:, priority:)` adds custom currencies. Only registered codes and symbols are recognized by the parser.
224
+ **Registered currencies** — `Currency.register(code:, subunit:, symbol:, priority:)` adds custom currencies. Only registered codes and symbols are recognized by the parser or searches. Nonetheless, you don't need to register a currency to use it with most of the features.
207
225
 
208
226
  **Built-in currencies** — 150+ ISO-4217 world currencies ship in `lib/minting/data/currencies.yaml` and load when the registry is first accessed.
209
227
 
@@ -242,7 +260,6 @@ cur = Currency.new(code: "EUR", symbol: "€", subunit: 2, priority: 0)
242
260
 
243
261
  ## Roadmap
244
262
 
245
- - Localization (I18n-aware formatting)
246
263
  - Exchange-rate conversion infrastructure
247
264
 
248
265
  ## License
data/bin/bench_check CHANGED
@@ -24,15 +24,26 @@ end
24
24
 
25
25
  current = JSON.parse(File.read(current_json.path))
26
26
 
27
+ MODES = %w[no_rounding half_down].freeze
28
+
29
+ all_ratios = []
27
30
  failures = []
28
- baseline['results'].each do |key, b|
29
- c = current.dig('results', key)
30
- next unless c
31
-
32
- ratio = c['ips'].to_f / b['ips']
33
- if ratio < threshold
34
- failures << format('%<key>-15s baseline: %<b>10d ips current: %<c>10d ips ratio: %<ratio>5.1f%%',
35
- key:, b: b['ips'], c: c['ips'], ratio: ratio * 100)
31
+ MODES.each do |mode|
32
+ b_mode = baseline.dig('results', mode)
33
+ c_mode = current.dig('results', mode)
34
+ next unless b_mode && c_mode
35
+
36
+ b_mode.each do |key, b|
37
+ c = c_mode[key]
38
+ next unless c
39
+
40
+ ratio = c['ips'].to_f / b['ips']
41
+ all_ratios << { mode:, key:, ratio:, b: b['ips'], c: c['ips'] }
42
+
43
+ if ratio < threshold
44
+ failures << format('%<mode>s %<key>-15s baseline: %<b>10d ips current: %<c>10d ips ratio: %<ratio>5.1f%%',
45
+ mode:, key:, b: b['ips'], c: c['ips'], ratio: ratio * 100)
46
+ end
36
47
  end
37
48
  end
38
49
 
@@ -42,5 +53,19 @@ if failures.empty?
42
53
  else
43
54
  puts 'Regressions detected:'
44
55
  failures.each { |f| puts " FAIL #{f}" }
45
- exit 1
46
56
  end
57
+
58
+ puts "\n--- Best vs Worst vs Baseline ---"
59
+ MODES.each do |mode|
60
+ entries = all_ratios.select { |r| r[:mode] == mode }
61
+ next if entries.empty?
62
+
63
+ best = entries.max_by { |r| r[:ratio] }
64
+ worst = entries.min_by { |r| r[:ratio] }
65
+
66
+ puts "#{mode}:"
67
+ puts " Best: #{format('%<key>-15s ratio: %<ratio>5.1f%% baseline: %<b>10d ips current: %<c>10d ips', key: best[:key], ratio: best[:ratio] * 100, b: best[:b], c: best[:c])}"
68
+ puts " Worst: #{format('%<key>-15s ratio: %<ratio>5.1f%% baseline: %<b>10d ips current: %<c>10d ips', key: worst[:key], ratio: worst[:ratio] * 100, b: worst[:b], c: worst[:c])}"
69
+ end
70
+
71
+ exit 1 unless failures.empty?
@@ -566,7 +566,7 @@ including its subunit precision, display symbol, and formatting rules.</p>
566
566
  <li class="public ">
567
567
  <span class="summary_signature">
568
568
 
569
- <a href="#zero-instance_method" title="#zero (instance method)">#<strong>zero</strong> &#x21d2; Object </a>
569
+ <a href="#zero-instance_method" title="#zero (instance method)">#<strong>zero</strong> &#x21d2; Money </a>
570
570
 
571
571
 
572
572
 
@@ -580,7 +580,7 @@ including its subunit precision, display symbol, and formatting rules.</p>
580
580
 
581
581
 
582
582
 
583
- <span class="summary_desc"><div class='inline'></div></span>
583
+ <span class="summary_desc"><div class='inline'><p>Returns the cached frozen zero-Money for this currency.</p></div></span>
584
584
 
585
585
  </li>
586
586
 
@@ -1205,12 +1205,12 @@ including its subunit precision, display symbol, and formatting rules.</p>
1205
1205
  <pre class="lines">
1206
1206
 
1207
1207
 
1208
- 95
1209
- 96
1210
- 97</pre>
1208
+ 100
1209
+ 101
1210
+ 102</pre>
1211
1211
  </td>
1212
1212
  <td>
1213
- <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 95</span>
1213
+ <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 100</span>
1214
1214
 
1215
1215
  <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Mint::Currency (class)">Currency</a></span></span><span class='period'>.</span><span class='id identifier rubyid_for_code'>for_code</span><span class='lparen'>(</span><span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span>
1216
1216
  <span class='const'><span class='object_link'><a href="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="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>
@@ -1278,12 +1278,12 @@ including its subunit precision, display symbol, and formatting rules.</p>
1278
1278
  <pre class="lines">
1279
1279
 
1280
1280
 
1281
- 103
1282
- 104
1283
- 105</pre>
1281
+ 108
1282
+ 109
1283
+ 110</pre>
1284
1284
  </td>
1285
1285
  <td>
1286
- <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 103</span>
1286
+ <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 108</span>
1287
1287
 
1288
1288
  <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Mint::Currency (class)">Currency</a></span></span><span class='period'>.</span><span class='id identifier rubyid_for_symbol'>for_symbol</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rparen'>)</span>
1289
1289
  <span class='const'><span class='object_link'><a href="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="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>
@@ -1427,12 +1427,12 @@ including its subunit precision, display symbol, and formatting rules.</p>
1427
1427
  <pre class="lines">
1428
1428
 
1429
1429
 
1430
- 57
1431
- 58
1432
- 59</pre>
1430
+ 62
1431
+ 63
1432
+ 64</pre>
1433
1433
  </td>
1434
1434
  <td>
1435
- <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 57</span>
1435
+ <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 62</span>
1436
1436
 
1437
1437
  <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Mint::Currency (class)">Currency</a></span></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'>&#39;</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>priority:</span> <span class='int'>0</span><span class='rparen'>)</span>
1438
1438
  <span class='const'><span class='object_link'><a href="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="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>
@@ -1519,18 +1519,18 @@ or the code is not registered</p></div>
1519
1519
  <pre class="lines">
1520
1520
 
1521
1521
 
1522
- 70
1523
- 71
1524
- 72
1525
- 73
1526
- 74
1527
1522
  75
1528
1523
  76
1529
1524
  77
1530
- 78</pre>
1525
+ 78
1526
+ 79
1527
+ 80
1528
+ 81
1529
+ 82
1530
+ 83</pre>
1531
1531
  </td>
1532
1532
  <td>
1533
- <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 70</span>
1533
+ <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 75</span>
1534
1534
 
1535
1535
  <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Mint::Currency (class)">Currency</a></span></span><span class='period'>.</span><span class='id identifier rubyid_resolve'>resolve</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
1536
1536
  <span class='kw'>case</span> <span class='id identifier rubyid_object'>object</span>
@@ -1621,12 +1621,12 @@ or the code is not registered</p></div>
1621
1621
  <pre class="lines">
1622
1622
 
1623
1623
 
1624
- 87
1625
- 88
1626
- 89</pre>
1624
+ 92
1625
+ 93
1626
+ 94</pre>
1627
1627
  </td>
1628
1628
  <td>
1629
- <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 87</span>
1629
+ <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 92</span>
1630
1630
 
1631
1631
  <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Mint::Currency (class)">Currency</a></span></span><span class='period'>.</span><span class='id identifier rubyid_resolve!'>resolve!</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
1632
1632
  <span class='id identifier rubyid_resolve'>resolve</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span> <span class='kw'>or</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'>&quot;</span><span class='tstring_content'>Could not resolve (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='embexpr_end'>}</span><span class='tstring_content'>) into a currency</span><span class='tstring_end'>&quot;</span></span>
@@ -1711,10 +1711,10 @@ for discounts, totals, or placeholders.</p>
1711
1711
  <pre class="lines">
1712
1712
 
1713
1713
 
1714
- 113</pre>
1714
+ 118</pre>
1715
1715
  </td>
1716
1716
  <td>
1717
- <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 113</span>
1717
+ <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 118</span>
1718
1718
 
1719
1719
  <span class='kw'>def</span> <span class='const'><span class='object_link'><a href="" title="Mint::Currency (class)">Currency</a></span></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="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="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="" title="Mint::Currency (class)">Currency</a></span></span><span class='period'>.</span><span class='id identifier rubyid_resolve!'><span class='object_link'><a href="#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>
1720
1720
  </td>
@@ -1863,7 +1863,7 @@ for discounts, totals, or placeholders.</p>
1863
1863
  <td>
1864
1864
  <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 43</span>
1865
1865
 
1866
- <span class='kw'>def</span> <span class='id identifier rubyid_normalize_amount'>normalize_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='rparen'>)</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Rounding.html" title="Mint::Rounding (module)">Rounding</a></span></span><span class='period'>.</span><span class='id identifier rubyid_apply'><span class='object_link'><a href="Rounding.html#apply-class_method" title="Mint::Rounding.apply (method)">apply</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_subunit'>subunit</span><span class='rparen'>)</span></pre>
1866
+ <span class='kw'>def</span> <span class='id identifier rubyid_normalize_amount'>normalize_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='rparen'>)</span> <span class='op'>=</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_to_r'>to_r</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='id identifier rubyid_subunit'>subunit</span><span class='rparen'>)</span></pre>
1867
1867
  </td>
1868
1868
  </tr>
1869
1869
  </table>
@@ -1872,22 +1872,55 @@ for discounts, totals, or placeholders.</p>
1872
1872
  <div class="method_details ">
1873
1873
  <h3 class="signature " id="zero-instance_method">
1874
1874
 
1875
- #<strong>zero</strong> &#x21d2; <tt>Object</tt>
1875
+ #<strong>zero</strong> &#x21d2; <tt><span class='object_link'><a href="Money.html" title="Mint::Money (class)">Money</a></span></tt>
1876
1876
 
1877
1877
 
1878
1878
 
1879
1879
 
1880
1880
 
1881
- </h3><table class="source_code">
1881
+ </h3><div class="docstring">
1882
+ <div class="discussion">
1883
+ <p>Returns the cached frozen zero-Money for this currency.</p>
1884
+
1885
+ </div>
1886
+ </div>
1887
+ <div class="tags">
1888
+
1889
+ <div class="examples">
1890
+ <h4 class="tag_title">Examples:</h4>
1891
+
1892
+
1893
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="Mint::Currency (class)">Currency</a></span></span><span class='period'>.</span><span class='id identifier rubyid_for_code'><span class='object_link'><a href="#for_code-class_method" title="Mint::Currency.for_code (method)">for_code</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>USD</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_zero'><span class='object_link'><a href="#zero-class_method" title="Mint::Currency.zero (method)">zero</a></span></span> <span class='comment'>#=&gt; [USD 0.00]</span></code></pre>
1894
+
1895
+ </div>
1896
+
1897
+ <p class="tag_title">Returns:</p>
1898
+ <ul class="return">
1899
+
1900
+ <li>
1901
+
1902
+
1903
+ <span class='type'>(<tt><span class='object_link'><a href="Money.html" title="Mint::Money (class)">Money</a></span></tt>)</span>
1904
+
1905
+
1906
+
1907
+ &mdash;
1908
+ <div class='inline'><p>a frozen zero-Money instance</p></div>
1909
+
1910
+ </li>
1911
+
1912
+ </ul>
1913
+
1914
+ </div><table class="source_code">
1882
1915
  <tr>
1883
1916
  <td>
1884
1917
  <pre class="lines">
1885
1918
 
1886
1919
 
1887
- 45</pre>
1920
+ 50</pre>
1888
1921
  </td>
1889
1922
  <td>
1890
- <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 45</span>
1923
+ <pre class="code"><span class="info file"># File 'lib/minting/currency/currency.rb', line 50</span>
1891
1924
 
1892
1925
  <span class='kw'>def</span> <span class='id identifier rubyid_zero'>zero</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="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="Registry.html#zero_for-class_method" title="Mint::Registry.zero_for (method)">zero_for</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span></pre>
1893
1926
  </td>
@@ -1900,7 +1933,7 @@ for discounts, totals, or placeholders.</p>
1900
1933
  </div>
1901
1934
 
1902
1935
  <div id="footer">
1903
- Generated on Tue Jun 16 20:22:19 2026 by
1936
+ Generated on Mon Jun 22 16:47:02 2026 by
1904
1937
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1905
1938
  0.9.44 (ruby-4.0.5).
1906
1939
  </div>