minting 1.6.3 → 1.7.2

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +71 -113
  3. data/Rakefile +25 -3
  4. data/bin/bench_check +46 -0
  5. data/doc/Mint/Currency.html +1139 -0
  6. data/doc/Mint/CurrencyRegistry.html +511 -0
  7. data/doc/Mint/Money.html +3859 -0
  8. data/doc/Mint/RangeStepPatch.html +277 -0
  9. data/doc/Mint/UnknownCurrency.html +136 -0
  10. data/doc/Mint.html +911 -0
  11. data/doc/Minting.html +142 -0
  12. data/doc/_index.html +173 -0
  13. data/doc/class_list.html +54 -0
  14. data/doc/css/common.css +1 -0
  15. data/doc/css/full_list.css +206 -0
  16. data/doc/css/style.css +1089 -0
  17. data/doc/file.README.html +275 -0
  18. data/doc/file_list.html +59 -0
  19. data/doc/frames.html +22 -0
  20. data/doc/index.html +275 -0
  21. data/doc/js/app.js +801 -0
  22. data/doc/js/full_list.js +334 -0
  23. data/doc/js/jquery.js +4 -0
  24. data/doc/method_list.html +518 -0
  25. data/doc/top-level-namespace.html +151 -0
  26. data/lib/minting/{mint/currency → currency}/currency.rb +8 -0
  27. data/lib/minting/{mint/currency → currency}/currency_registry.rb +1 -1
  28. data/lib/minting/{mint/currency → currency}/world_currencies.rb +1 -1
  29. data/lib/minting/mint/aliases.rb +3 -0
  30. data/lib/minting/mint/dsl/numeric.rb +23 -0
  31. data/lib/minting/mint/dsl/range.rb +67 -0
  32. data/lib/minting/mint/dsl/string.rb +12 -0
  33. data/lib/minting/mint/{dsl.rb → dsl/top_level.rb} +3 -18
  34. data/lib/minting/mint/mint.rb +17 -3
  35. data/lib/minting/mint/{parser.rb → parser/parser.rb} +17 -29
  36. data/lib/minting/mint/parser/separators.rb +39 -0
  37. data/lib/minting/mint.rb +19 -8
  38. data/lib/minting/money/allocation/allocation.rb +25 -0
  39. data/lib/minting/money/allocation/split.rb +41 -0
  40. data/lib/minting/money/arithmetics/methods.rb +27 -0
  41. data/lib/minting/money/{arithmetics.rb → arithmetics/operators.rb} +5 -26
  42. data/lib/minting/money/clamp.rb +66 -0
  43. data/lib/minting/money/coercion.rb +18 -11
  44. data/lib/minting/money/comparable.rb +6 -0
  45. data/lib/minting/money/constructors.rb +13 -3
  46. data/lib/minting/money/format/formatting.rb +44 -0
  47. data/lib/minting/money/{formatting.rb → format/to_s.rb} +5 -42
  48. data/lib/minting/money/money.rb +0 -58
  49. data/lib/minting/version.rb +1 -1
  50. data/minting.gemspec +5 -2
  51. metadata +42 -11
  52. data/lib/minting/money/allocation.rb +0 -59
@@ -0,0 +1,277 @@
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::RangeStepPatch
8
+
9
+ &mdash; 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::RangeStepPatch";
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> &raquo;
42
+ <span class='title'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span>
43
+ &raquo;
44
+ <span class="title">RangeStepPatch</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::RangeStepPatch
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/dsl/range.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>Ruby &lt; 4.0's Range#step calls rb_to_int on non-Numeric step arguments,
96
+ which raises TypeError for Money objects. Ruby 4.0+ uses arithmetic
97
+ iteration (+ / &lt;=&gt;) for non-numeric steps natively, so this patch is
98
+ only needed on older Rubies.</p>
99
+
100
+ </div>
101
+ </div>
102
+ <div class="tags">
103
+
104
+
105
+ </div>
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+ <h2>
114
+ Instance Method Summary
115
+ <small><a href="#" class="summary_toggle">collapse</a></small>
116
+ </h2>
117
+
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#step-instance_method" title="#step (instance method)">#<strong>step</strong>(step_size = nil, &amp;block) &#x21d2; self, Enumerator </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+
133
+
134
+ <span class="private note title">private</span>
135
+
136
+
137
+ <span class="summary_desc"><div class='inline'><p>Iterates over the range using a Money step value.</p></div></span>
138
+
139
+ </li>
140
+
141
+
142
+ </ul>
143
+
144
+
145
+
146
+
147
+
148
+ <div id="instance_method_details" class="method_details_list">
149
+ <h2>Instance Method Details</h2>
150
+
151
+
152
+ <div class="method_details first">
153
+ <h3 class="signature first" id="step-instance_method">
154
+
155
+ #<strong>step</strong>(step_size = nil, &amp;block) &#x21d2; <tt>self</tt>, <tt>Enumerator</tt>
156
+
157
+
158
+
159
+
160
+
161
+ </h3><div class="docstring">
162
+ <div class="discussion">
163
+ <p class="note private">
164
+ <strong>This method is part of a private API.</strong>
165
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
166
+ </p>
167
+ <p>Iterates over the range using a Money step value.
168
+ Overrides Range#step to handle Mint::Money step sizes on Ruby &lt; 4.0.</p>
169
+
170
+ </div>
171
+ </div>
172
+ <div class="tags">
173
+ <p class="tag_title">Parameters:</p>
174
+ <ul class="param">
175
+
176
+ <li>
177
+
178
+ <span class='name'>step_size</span>
179
+
180
+
181
+ <span class='type'>(<tt><span class='object_link'><a href="Money.html" title="Mint::Money (class)">Mint::Money</a></span></tt>, <tt>nil</tt>)</span>
182
+
183
+
184
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
185
+
186
+
187
+ &mdash;
188
+ <div class='inline'><p>step amount</p></div>
189
+
190
+ </li>
191
+
192
+ </ul>
193
+
194
+ <p class="tag_title">Returns:</p>
195
+ <ul class="return">
196
+
197
+ <li>
198
+
199
+
200
+ <span class='type'>(<tt>self</tt>, <tt>Enumerator</tt>)</span>
201
+
202
+
203
+
204
+ &mdash;
205
+ <div class='inline'><p>self if block given, Enumerator otherwise</p></div>
206
+
207
+ </li>
208
+
209
+ </ul>
210
+ <p class="tag_title">Raises:</p>
211
+ <ul class="raise">
212
+
213
+ <li>
214
+
215
+
216
+ <span class='type'>(<tt>TypeError</tt>)</span>
217
+
218
+
219
+
220
+ </li>
221
+
222
+ </ul>
223
+
224
+ </div><table class="source_code">
225
+ <tr>
226
+ <td>
227
+ <pre class="lines">
228
+
229
+
230
+ 17
231
+ 18
232
+ 19
233
+ 20
234
+ 21
235
+ 22
236
+ 23
237
+ 24
238
+ 25
239
+ 26
240
+ 27
241
+ 28
242
+ 29</pre>
243
+ </td>
244
+ <td>
245
+ <pre class="code"><span class="info file"># File 'lib/minting/mint/dsl/range.rb', line 17</span>
246
+
247
+ <span class='kw'>def</span> <span class='id identifier rubyid_step'>step</span><span class='lparen'>(</span><span class='id identifier rubyid_step_size'>step_size</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
248
+ <span class='kw'>return</span> <span class='kw'>super</span> <span class='kw'>unless</span> <span class='id identifier rubyid_step_size'>step_size</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="../Mint.html" title="Mint (module)">Mint</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Money.html" title="Mint::Money (class)">Money</a></span></span><span class='rparen'>)</span>
249
+
250
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>TypeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>can&#39;t iterate from NilClass</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_begin'>begin</span>
251
+ <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'>step can&#39;t be 0</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_step_size'>step_size</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
252
+
253
+ <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span>
254
+ <span class='id identifier rubyid_each_money_step'>each_money_step</span><span class='lparen'>(</span><span class='id identifier rubyid_step_size'>step_size</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
255
+ <span class='kw'>self</span>
256
+ <span class='kw'>else</span>
257
+ <span class='const'>Enumerator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_yielder'>yielder</span><span class='op'>|</span> <span class='id identifier rubyid_each_money_step'>each_money_step</span><span class='lparen'>(</span><span class='id identifier rubyid_step_size'>step_size</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_yielder'>yielder</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
258
+ <span class='kw'>end</span>
259
+ <span class='kw'>end</span></pre>
260
+ </td>
261
+ </tr>
262
+ </table>
263
+ </div>
264
+
265
+ </div>
266
+
267
+ </div>
268
+
269
+ <div id="footer">
270
+ Generated on Sun Jun 14 21:57:01 2026 by
271
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
272
+ 0.9.44 (ruby-4.0.5).
273
+ </div>
274
+
275
+ </div>
276
+ </body>
277
+ </html>
@@ -0,0 +1,136 @@
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
+ &mdash; 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> &raquo;
42
+ <span class='title'><span class='object_link'><a href="../Mint.html" title="Mint (module)">Mint</a></span></span>
43
+ &raquo;
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 Sun Jun 14 21:57:01 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>