minting 1.9.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +244 -121
- data/Rakefile +17 -26
- data/bin/bench_check +2 -2
- data/doc/agents/api_review-2026-06-15.md +1 -1
- data/doc/agents/copilot-instructions.md +5 -5
- data/doc/agents/expired/copilot-instructions.md +2 -2
- data/doc/agents/expired/gemini_gem_evaluation.md +2 -2
- data/lib/minting/aliases.rb +22 -0
- data/lib/minting/currency/currency.rb +87 -12
- data/lib/minting/data/crypto-currencies.yaml +126 -0
- data/lib/minting/data/world-currencies.yaml +75 -23
- data/lib/minting/mint/i18n.rb +79 -29
- data/lib/minting/mint/mint.rb +1 -26
- data/lib/minting/mint/registry/crypto.rb +59 -0
- data/lib/minting/mint/registry/registration.rb +1 -2
- data/lib/minting/mint/registry/symbols.rb +37 -30
- data/lib/minting/mint/rounding.rb +10 -7
- data/lib/minting/mint.rb +1 -2
- data/lib/minting/money/allocation/allocation.rb +2 -2
- data/lib/minting/money/allocation/split.rb +1 -1
- data/lib/minting/money/arithmetics/operators.rb +10 -13
- data/lib/minting/money/clamp.rb +6 -6
- data/lib/minting/money/coercion.rb +1 -1
- data/lib/minting/money/comparable.rb +3 -3
- data/lib/minting/money/constructors.rb +3 -42
- data/lib/minting/money/conversion.rb +23 -18
- data/lib/minting/money/format/format.rb +100 -0
- data/lib/minting/money/format/formatter.rb +102 -0
- data/lib/minting/money/format/to_s.rb +34 -99
- data/lib/minting/money/format/validator.rb +34 -0
- data/lib/minting/money/money.rb +25 -13
- data/lib/minting/money/parse.rb +127 -0
- data/lib/minting/money/rounding.rb +27 -0
- data/lib/minting/version.rb +1 -1
- data/lib/minting.rb +17 -8
- metadata +9 -28
- data/doc/Mint/Currency.html +0 -1943
- data/doc/Mint/CurrencyRegistry.html +0 -511
- data/doc/Mint/Money.html +0 -4607
- data/doc/Mint/RangeStepPatch.html +0 -277
- data/doc/Mint/Registry.html +0 -863
- data/doc/Mint/Rounding.html +0 -506
- data/doc/Mint/UnknownCurrency.html +0 -136
- data/doc/Mint.html +0 -1004
- data/doc/Minting.html +0 -142
- data/doc/_index.html +0 -180
- data/doc/class_list.html +0 -54
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -206
- data/doc/css/style.css +0 -1089
- data/doc/file.README.html +0 -277
- data/doc/file_list.html +0 -59
- data/doc/frames.html +0 -22
- data/doc/index.html +0 -277
- data/doc/js/app.js +0 -801
- data/doc/js/full_list.js +0 -334
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -686
- data/doc/top-level-namespace.html +0 -151
- data/lib/minting/mint/aliases.rb +0 -16
- data/lib/minting/mint/parser/parser.rb +0 -97
- data/lib/minting/mint/parser/separators.rb +0 -41
- data/lib/minting/money/format/formatting.rb +0 -97
data/doc/Mint/Rounding.html
DELETED
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>
|
|
7
|
-
Module: Mint::Rounding
|
|
8
|
-
|
|
9
|
-
— Documentation by YARD 0.9.44
|
|
10
|
-
|
|
11
|
-
</title>
|
|
12
|
-
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css">
|
|
14
|
-
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css">
|
|
16
|
-
|
|
17
|
-
<script type="text/javascript">
|
|
18
|
-
pathId = "Mint::Rounding";
|
|
19
|
-
relpath = '../';
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
24
|
-
|
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</head>
|
|
29
|
-
<body>
|
|
30
|
-
<div id="main_progress" aria-hidden="true"></div>
|
|
31
|
-
|
|
32
|
-
<div class="nav_wrap">
|
|
33
|
-
<iframe id="nav" src="../class_list.html?1"></iframe>
|
|
34
|
-
<div id="resizer"></div>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<div id="main" tabindex="-1">
|
|
38
|
-
<div id="header">
|
|
39
|
-
<div id="menu">
|
|
40
|
-
|
|
41
|
-
<a href="../_index.html">Index (R)</a> »
|
|
42
|
-
<span class='title'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span>
|
|
43
|
-
»
|
|
44
|
-
<span class="title">Rounding</span>
|
|
45
|
-
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<div id="search">
|
|
49
|
-
|
|
50
|
-
<a class="full_list_link" id="class_list_link"
|
|
51
|
-
href="../class_list.html">
|
|
52
|
-
|
|
53
|
-
<svg width="24" height="24">
|
|
54
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
56
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
57
|
-
</svg>
|
|
58
|
-
</a>
|
|
59
|
-
|
|
60
|
-
</div>
|
|
61
|
-
<div class="clear"></div>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div id="content"><h1>Module: Mint::Rounding
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<span class="private note title">Private</span>
|
|
68
|
-
</h1>
|
|
69
|
-
<div class="box_info">
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<dl>
|
|
82
|
-
<dt>Defined in:</dt>
|
|
83
|
-
<dd>lib/minting/mint/rounding.rb
|
|
84
|
-
</dd>
|
|
85
|
-
</dl>
|
|
86
|
-
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<h2>Overview</h2><div class="docstring">
|
|
90
|
-
<div class="discussion">
|
|
91
|
-
<p class="note private">
|
|
92
|
-
<strong>This module is part of a private API.</strong>
|
|
93
|
-
You should avoid using this module if possible, as it may be removed or be changed in the future.
|
|
94
|
-
</p>
|
|
95
|
-
<p>Rounding-mode dispatch table and block-scoped context.</p>
|
|
96
|
-
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
<div class="tags">
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
</div>
|
|
103
|
-
|
|
104
|
-
<h2>
|
|
105
|
-
Constant Summary
|
|
106
|
-
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
|
107
|
-
</h2>
|
|
108
|
-
|
|
109
|
-
<dl class="constants">
|
|
110
|
-
|
|
111
|
-
<dt id="MODES-constant" class="">MODES =
|
|
112
|
-
<div class="docstring">
|
|
113
|
-
<div class="discussion">
|
|
114
|
-
<p class="note private">
|
|
115
|
-
<strong>This constant is part of a private API.</strong>
|
|
116
|
-
You should avoid using this constant if possible, as it may be removed or be changed in the future.
|
|
117
|
-
</p>
|
|
118
|
-
<p>Maps mode symbols to their corresponding <code>Rational</code> rounding lambdas.</p>
|
|
119
|
-
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
<div class="tags">
|
|
123
|
-
|
|
124
|
-
<p class="tag_title">Returns:</p>
|
|
125
|
-
<ul class="return">
|
|
126
|
-
|
|
127
|
-
<li>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<span class='type'>(<tt>Hash{Symbol => Proc}</tt>)</span>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
</li>
|
|
135
|
-
|
|
136
|
-
</ul>
|
|
137
|
-
|
|
138
|
-
</div>
|
|
139
|
-
</dt>
|
|
140
|
-
<dd><pre class="code"><span class='lbrace'>{</span>
|
|
141
|
-
<span class='label'>half_up:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='id identifier rubyid_ndigits'>ndigits</span><span class='comma'>,</span> <span class='label'>half:</span> <span class='symbol'>:up</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
|
142
|
-
<span class='label'>half_down:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='id identifier rubyid_ndigits'>ndigits</span><span class='comma'>,</span> <span class='label'>half:</span> <span class='symbol'>:down</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
|
143
|
-
<span class='label'>floor:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span><span class='lparen'>(</span><span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
|
144
|
-
<span class='label'>ceil:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_ceil'>ceil</span><span class='lparen'>(</span><span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
|
145
|
-
<span class='label'>truncate:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_truncate'>truncate</span><span class='lparen'>(</span><span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
|
146
|
-
<span class='label'>down:</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_truncate'>truncate</span><span class='lparen'>(</span><span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
147
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
|
148
|
-
|
|
149
|
-
</dl>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
<h2>
|
|
160
|
-
Class Method Summary
|
|
161
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
162
|
-
</h2>
|
|
163
|
-
|
|
164
|
-
<ul class="summary">
|
|
165
|
-
|
|
166
|
-
<li class="public ">
|
|
167
|
-
<span class="summary_signature">
|
|
168
|
-
|
|
169
|
-
<a href="#apply-class_method" title="apply (class method)">.<strong>apply</strong>(amount, ndigits) ⇒ Rational </a>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
</span>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
<span class="private note title">private</span>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
<span class="summary_desc"><div class='inline'><p>Rounds <code>amount</code> to <code>ndigits</code> using the currently scoped rounding mode.</p></div></span>
|
|
184
|
-
|
|
185
|
-
</li>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<li class="public ">
|
|
189
|
-
<span class="summary_signature">
|
|
190
|
-
|
|
191
|
-
<a href="#current_mode-class_method" title="current_mode (class method)">.<strong>current_mode</strong> ⇒ Symbol </a>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
</span>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<span class="private note title">private</span>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
<span class="summary_desc"><div class='inline'><p>Returns the currently active rounding mode, falling back to <code>:half_up</code>.</p></div></span>
|
|
206
|
-
|
|
207
|
-
</li>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
<li class="public ">
|
|
211
|
-
<span class="summary_signature">
|
|
212
|
-
|
|
213
|
-
<a href="#with_mode-class_method" title="with_mode (class method)">.<strong>with_mode</strong>(mode) { ... } ⇒ Object </a>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
</span>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
<span class="private note title">private</span>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
<span class="summary_desc"><div class='inline'><p>Sets a rounding mode for the duration of a block, restoring the previous mode on exit (even on exception).</p></div></span>
|
|
228
|
-
|
|
229
|
-
</li>
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
</ul>
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
<div id="class_method_details" class="method_details_list">
|
|
239
|
-
<h2>Class Method Details</h2>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<div class="method_details first">
|
|
243
|
-
<h3 class="signature first" id="apply-class_method">
|
|
244
|
-
|
|
245
|
-
.<strong>apply</strong>(amount, ndigits) ⇒ <tt>Rational</tt>
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
</h3><div class="docstring">
|
|
252
|
-
<div class="discussion">
|
|
253
|
-
<p class="note private">
|
|
254
|
-
<strong>This method is part of a private API.</strong>
|
|
255
|
-
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
|
256
|
-
</p>
|
|
257
|
-
<p>Rounds <code>amount</code> to <code>ndigits</code> using the currently scoped rounding mode.
|
|
258
|
-
Uses the fast path (+to_r.round+) when no custom mode is active.</p>
|
|
259
|
-
|
|
260
|
-
</div>
|
|
261
|
-
</div>
|
|
262
|
-
<div class="tags">
|
|
263
|
-
<p class="tag_title">Parameters:</p>
|
|
264
|
-
<ul class="param">
|
|
265
|
-
|
|
266
|
-
<li>
|
|
267
|
-
|
|
268
|
-
<span class='name'>amount</span>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
<span class='type'>(<tt>Numeric</tt>)</span>
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
</li>
|
|
276
|
-
|
|
277
|
-
<li>
|
|
278
|
-
|
|
279
|
-
<span class='name'>ndigits</span>
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
</li>
|
|
287
|
-
|
|
288
|
-
</ul>
|
|
289
|
-
|
|
290
|
-
<p class="tag_title">Returns:</p>
|
|
291
|
-
<ul class="return">
|
|
292
|
-
|
|
293
|
-
<li>
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
<span class='type'>(<tt>Rational</tt>)</span>
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
</li>
|
|
301
|
-
|
|
302
|
-
</ul>
|
|
303
|
-
|
|
304
|
-
</div><table class="source_code">
|
|
305
|
-
<tr>
|
|
306
|
-
<td>
|
|
307
|
-
<pre class="lines">
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
32
|
|
311
|
-
33
|
|
312
|
-
34
|
|
313
|
-
35
|
|
314
|
-
36
|
|
315
|
-
37
|
|
316
|
-
38
|
|
317
|
-
39</pre>
|
|
318
|
-
</td>
|
|
319
|
-
<td>
|
|
320
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/rounding.rb', line 32</span>
|
|
321
|
-
|
|
322
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_apply'>apply</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='comma'>,</span> <span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span>
|
|
323
|
-
<span class='id identifier rubyid_mode'>mode</span> <span class='op'>=</span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:minting_rounding_mode</span><span class='rbracket'>]</span>
|
|
324
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_mode'>mode</span>
|
|
325
|
-
<span class='const'><span class='object_link'><a href="#MODES-constant" title="Mint::Rounding::MODES (constant)">MODES</a></span></span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_mode'>mode</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</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='comma'>,</span> <span class='id identifier rubyid_ndigits'>ndigits</span><span class='rparen'>)</span>
|
|
326
|
-
<span class='kw'>else</span>
|
|
327
|
-
<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_ndigits'>ndigits</span><span class='rparen'>)</span>
|
|
328
|
-
<span class='kw'>end</span>
|
|
329
|
-
<span class='kw'>end</span></pre>
|
|
330
|
-
</td>
|
|
331
|
-
</tr>
|
|
332
|
-
</table>
|
|
333
|
-
</div>
|
|
334
|
-
|
|
335
|
-
<div class="method_details ">
|
|
336
|
-
<h3 class="signature " id="current_mode-class_method">
|
|
337
|
-
|
|
338
|
-
.<strong>current_mode</strong> ⇒ <tt>Symbol</tt>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
</h3><div class="docstring">
|
|
345
|
-
<div class="discussion">
|
|
346
|
-
<p class="note private">
|
|
347
|
-
<strong>This method is part of a private API.</strong>
|
|
348
|
-
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
|
349
|
-
</p>
|
|
350
|
-
<p>Returns the currently active rounding mode, falling back to <code>:half_up</code>.</p>
|
|
351
|
-
|
|
352
|
-
</div>
|
|
353
|
-
</div>
|
|
354
|
-
<div class="tags">
|
|
355
|
-
|
|
356
|
-
<p class="tag_title">Returns:</p>
|
|
357
|
-
<ul class="return">
|
|
358
|
-
|
|
359
|
-
<li>
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
</li>
|
|
367
|
-
|
|
368
|
-
</ul>
|
|
369
|
-
|
|
370
|
-
</div><table class="source_code">
|
|
371
|
-
<tr>
|
|
372
|
-
<td>
|
|
373
|
-
<pre class="lines">
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
22
|
|
377
|
-
23
|
|
378
|
-
24</pre>
|
|
379
|
-
</td>
|
|
380
|
-
<td>
|
|
381
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/rounding.rb', line 22</span>
|
|
382
|
-
|
|
383
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_current_mode'>current_mode</span>
|
|
384
|
-
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:minting_rounding_mode</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='symbol'>:half_up</span>
|
|
385
|
-
<span class='kw'>end</span></pre>
|
|
386
|
-
</td>
|
|
387
|
-
</tr>
|
|
388
|
-
</table>
|
|
389
|
-
</div>
|
|
390
|
-
|
|
391
|
-
<div class="method_details ">
|
|
392
|
-
<h3 class="signature " id="with_mode-class_method">
|
|
393
|
-
|
|
394
|
-
.<strong>with_mode</strong>(mode) { ... } ⇒ <tt>Object</tt>
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
</h3><div class="docstring">
|
|
401
|
-
<div class="discussion">
|
|
402
|
-
<p class="note private">
|
|
403
|
-
<strong>This method is part of a private API.</strong>
|
|
404
|
-
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
|
405
|
-
</p>
|
|
406
|
-
<p>Sets a rounding mode for the duration of a block, restoring the
|
|
407
|
-
previous mode on exit (even on exception).</p>
|
|
408
|
-
|
|
409
|
-
</div>
|
|
410
|
-
</div>
|
|
411
|
-
<div class="tags">
|
|
412
|
-
<p class="tag_title">Parameters:</p>
|
|
413
|
-
<ul class="param">
|
|
414
|
-
|
|
415
|
-
<li>
|
|
416
|
-
|
|
417
|
-
<span class='name'>mode</span>
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
</li>
|
|
425
|
-
|
|
426
|
-
</ul>
|
|
427
|
-
|
|
428
|
-
<p class="tag_title">Yields:</p>
|
|
429
|
-
<ul class="yield">
|
|
430
|
-
|
|
431
|
-
<li>
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
<span class='type'></span>
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
<div class='inline'><p>block to execute with the mode active</p></div>
|
|
440
|
-
|
|
441
|
-
</li>
|
|
442
|
-
|
|
443
|
-
</ul>
|
|
444
|
-
<p class="tag_title">Raises:</p>
|
|
445
|
-
<ul class="raise">
|
|
446
|
-
|
|
447
|
-
<li>
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
—
|
|
455
|
-
<div class='inline'><p>on unknown mode</p></div>
|
|
456
|
-
|
|
457
|
-
</li>
|
|
458
|
-
|
|
459
|
-
</ul>
|
|
460
|
-
|
|
461
|
-
</div><table class="source_code">
|
|
462
|
-
<tr>
|
|
463
|
-
<td>
|
|
464
|
-
<pre class="lines">
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
47
|
|
468
|
-
48
|
|
469
|
-
49
|
|
470
|
-
50
|
|
471
|
-
51
|
|
472
|
-
52
|
|
473
|
-
53
|
|
474
|
-
54
|
|
475
|
-
55</pre>
|
|
476
|
-
</td>
|
|
477
|
-
<td>
|
|
478
|
-
<pre class="code"><span class="info file"># File 'lib/minting/mint/rounding.rb', line 47</span>
|
|
479
|
-
|
|
480
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_with_mode'>with_mode</span><span class='lparen'>(</span><span class='id identifier rubyid_mode'>mode</span><span class='rparen'>)</span>
|
|
481
|
-
<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'>Unknown rounding mode: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_mode'>mode</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='const'><span class='object_link'><a href="#MODES-constant" title="Mint::Rounding::MODES (constant)">MODES</a></span></span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_mode'>mode</span><span class='rparen'>)</span>
|
|
482
|
-
|
|
483
|
-
<span class='id identifier rubyid_prev'>prev</span> <span class='op'>=</span> <span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:minting_rounding_mode</span><span class='rbracket'>]</span>
|
|
484
|
-
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:minting_rounding_mode</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_mode'>mode</span>
|
|
485
|
-
<span class='kw'>yield</span>
|
|
486
|
-
<span class='kw'>ensure</span>
|
|
487
|
-
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='symbol'>:minting_rounding_mode</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_prev'>prev</span>
|
|
488
|
-
<span class='kw'>end</span></pre>
|
|
489
|
-
</td>
|
|
490
|
-
</tr>
|
|
491
|
-
</table>
|
|
492
|
-
</div>
|
|
493
|
-
|
|
494
|
-
</div>
|
|
495
|
-
|
|
496
|
-
</div>
|
|
497
|
-
|
|
498
|
-
<div id="footer">
|
|
499
|
-
Generated on Mon Jun 22 16:47:02 2026 by
|
|
500
|
-
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
501
|
-
0.9.44 (ruby-4.0.5).
|
|
502
|
-
</div>
|
|
503
|
-
|
|
504
|
-
</div>
|
|
505
|
-
</body>
|
|
506
|
-
</html>
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>
|
|
7
|
-
Exception: Mint::UnknownCurrency
|
|
8
|
-
|
|
9
|
-
— Documentation by YARD 0.9.44
|
|
10
|
-
|
|
11
|
-
</title>
|
|
12
|
-
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css">
|
|
14
|
-
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css">
|
|
16
|
-
|
|
17
|
-
<script type="text/javascript">
|
|
18
|
-
pathId = "Mint::UnknownCurrency";
|
|
19
|
-
relpath = '../';
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
24
|
-
|
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</head>
|
|
29
|
-
<body>
|
|
30
|
-
<div id="main_progress" aria-hidden="true"></div>
|
|
31
|
-
|
|
32
|
-
<div class="nav_wrap">
|
|
33
|
-
<iframe id="nav" src="../class_list.html?1"></iframe>
|
|
34
|
-
<div id="resizer"></div>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<div id="main" tabindex="-1">
|
|
38
|
-
<div id="header">
|
|
39
|
-
<div id="menu">
|
|
40
|
-
|
|
41
|
-
<a href="../_index.html">Index (U)</a> »
|
|
42
|
-
<span class='title'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span>
|
|
43
|
-
»
|
|
44
|
-
<span class="title">UnknownCurrency</span>
|
|
45
|
-
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<div id="search">
|
|
49
|
-
|
|
50
|
-
<a class="full_list_link" id="class_list_link"
|
|
51
|
-
href="../class_list.html">
|
|
52
|
-
|
|
53
|
-
<svg width="24" height="24">
|
|
54
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
56
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
57
|
-
</svg>
|
|
58
|
-
</a>
|
|
59
|
-
|
|
60
|
-
</div>
|
|
61
|
-
<div class="clear"></div>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div id="content"><h1>Exception: Mint::UnknownCurrency
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
</h1>
|
|
69
|
-
<div class="box_info">
|
|
70
|
-
|
|
71
|
-
<dl>
|
|
72
|
-
<dt>Inherits:</dt>
|
|
73
|
-
<dd>
|
|
74
|
-
<span class="inheritName">StandardError</span>
|
|
75
|
-
|
|
76
|
-
<ul class="fullTree">
|
|
77
|
-
<li>Object</li>
|
|
78
|
-
|
|
79
|
-
<li class="next">StandardError</li>
|
|
80
|
-
|
|
81
|
-
<li class="next">Mint::UnknownCurrency</li>
|
|
82
|
-
|
|
83
|
-
</ul>
|
|
84
|
-
<a href="#" class="inheritanceTree">show all</a>
|
|
85
|
-
|
|
86
|
-
</dd>
|
|
87
|
-
</dl>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<dl>
|
|
100
|
-
<dt>Defined in:</dt>
|
|
101
|
-
<dd>lib/minting/mint/mint.rb
|
|
102
|
-
</dd>
|
|
103
|
-
</dl>
|
|
104
|
-
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<h2>Overview</h2><div class="docstring">
|
|
108
|
-
<div class="discussion">
|
|
109
|
-
<p>Unknown currency excpetion</p>
|
|
110
|
-
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="tags">
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
<div id="footer">
|
|
129
|
-
Generated on Mon Jun 22 16:47:02 2026 by
|
|
130
|
-
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
131
|
-
0.9.44 (ruby-4.0.5).
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
</div>
|
|
135
|
-
</body>
|
|
136
|
-
</html>
|