option_lab 0.1.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.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +139 -0
  4. data/.yard/hooks/before_generate.rb +7 -0
  5. data/.yardopts +11 -0
  6. data/Gemfile +26 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +180 -0
  9. data/Rakefile +44 -0
  10. data/docs/OptionLab/BinomialTree.html +1271 -0
  11. data/docs/OptionLab/BjerksundStensland.html +2022 -0
  12. data/docs/OptionLab/BlackScholes.html +2388 -0
  13. data/docs/OptionLab/Engine.html +1716 -0
  14. data/docs/OptionLab/Models/AmericanModelInputs.html +937 -0
  15. data/docs/OptionLab/Models/ArrayInputs.html +463 -0
  16. data/docs/OptionLab/Models/BaseModel.html +223 -0
  17. data/docs/OptionLab/Models/BinomialModelInputs.html +1161 -0
  18. data/docs/OptionLab/Models/BlackScholesInfo.html +967 -0
  19. data/docs/OptionLab/Models/BlackScholesModelInputs.html +851 -0
  20. data/docs/OptionLab/Models/ClosedPosition.html +445 -0
  21. data/docs/OptionLab/Models/EngineData.html +2523 -0
  22. data/docs/OptionLab/Models/EngineDataResults.html +435 -0
  23. data/docs/OptionLab/Models/Inputs.html +2241 -0
  24. data/docs/OptionLab/Models/LaplaceInputs.html +777 -0
  25. data/docs/OptionLab/Models/Option.html +736 -0
  26. data/docs/OptionLab/Models/Outputs.html +1753 -0
  27. data/docs/OptionLab/Models/PoPOutputs.html +645 -0
  28. data/docs/OptionLab/Models/PricingResult.html +848 -0
  29. data/docs/OptionLab/Models/Stock.html +583 -0
  30. data/docs/OptionLab/Models/TreeVisualization.html +688 -0
  31. data/docs/OptionLab/Models.html +251 -0
  32. data/docs/OptionLab/Plotting.html +548 -0
  33. data/docs/OptionLab/Support.html +2884 -0
  34. data/docs/OptionLab/Utils.html +619 -0
  35. data/docs/OptionLab.html +133 -0
  36. data/docs/_index.html +376 -0
  37. data/docs/class_list.html +54 -0
  38. data/docs/css/common.css +1 -0
  39. data/docs/css/full_list.css +58 -0
  40. data/docs/css/style.css +503 -0
  41. data/docs/file.LICENSE.html +70 -0
  42. data/docs/file.README.html +263 -0
  43. data/docs/file_list.html +64 -0
  44. data/docs/frames.html +22 -0
  45. data/docs/index.html +263 -0
  46. data/docs/js/app.js +344 -0
  47. data/docs/js/full_list.js +242 -0
  48. data/docs/js/jquery.js +4 -0
  49. data/docs/method_list.html +1974 -0
  50. data/docs/top-level-namespace.html +110 -0
  51. data/examples/american_options.rb +163 -0
  52. data/examples/covered_call.rb +76 -0
  53. data/lib/option_lab/binomial_tree.rb +238 -0
  54. data/lib/option_lab/bjerksund_stensland.rb +276 -0
  55. data/lib/option_lab/black_scholes.rb +323 -0
  56. data/lib/option_lab/engine.rb +492 -0
  57. data/lib/option_lab/models.rb +768 -0
  58. data/lib/option_lab/plotting.rb +182 -0
  59. data/lib/option_lab/support.rb +471 -0
  60. data/lib/option_lab/utils.rb +107 -0
  61. data/lib/option_lab/version.rb +5 -0
  62. data/lib/option_lab.rb +134 -0
  63. data/option_lab.gemspec +43 -0
  64. metadata +207 -0
@@ -0,0 +1,463 @@
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
+ Class: OptionLab::Models::ArrayInputs
8
+
9
+ &mdash; OptionLab Documentation
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 = "OptionLab::Models::ArrayInputs";
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 class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (A)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../OptionLab.html" title="OptionLab (module)">OptionLab</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Models.html" title="OptionLab::Models (module)">Models</a></span></span>
41
+ &raquo;
42
+ <span class="title">ArrayInputs</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: OptionLab::Models::ArrayInputs
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="BaseModel.html" title="OptionLab::Models::BaseModel (class)">BaseModel</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="BaseModel.html" title="OptionLab::Models::BaseModel (class)">BaseModel</a></span></li>
78
+
79
+ <li class="next">OptionLab::Models::ArrayInputs</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/option_lab/models.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p>Array inputs model</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+
116
+
117
+
118
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
119
+ <ul class="summary">
120
+
121
+ <li class="public ">
122
+ <span class="summary_signature">
123
+
124
+ <a href="#array-instance_method" title="#array (instance method)">#<strong>array</strong> &#x21d2; Object </a>
125
+
126
+
127
+
128
+ </span>
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute array.</p>
142
+ </div></span>
143
+
144
+ </li>
145
+
146
+
147
+ <li class="public ">
148
+ <span class="summary_signature">
149
+
150
+ <a href="#model-instance_method" title="#model (instance method)">#<strong>model</strong> &#x21d2; Object </a>
151
+
152
+
153
+
154
+ </span>
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute model.</p>
168
+ </div></span>
169
+
170
+ </li>
171
+
172
+
173
+ </ul>
174
+
175
+
176
+
177
+
178
+
179
+ <h2>
180
+ Instance Method Summary
181
+ <small><a href="#" class="summary_toggle">collapse</a></small>
182
+ </h2>
183
+
184
+ <ul class="summary">
185
+
186
+ <li class="public ">
187
+ <span class="summary_signature">
188
+
189
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(attributes = {}) &#x21d2; ArrayInputs </a>
190
+
191
+
192
+
193
+ </span>
194
+
195
+
196
+ <span class="note title constructor">constructor</span>
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+ <span class="summary_desc"><div class='inline'><p>A new instance of ArrayInputs.</p>
206
+ </div></span>
207
+
208
+ </li>
209
+
210
+
211
+ <li class="public ">
212
+ <span class="summary_signature">
213
+
214
+ <a href="#validate!-instance_method" title="#validate! (instance method)">#<strong>validate!</strong> &#x21d2; Object </a>
215
+
216
+
217
+
218
+ </span>
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+ <span class="summary_desc"><div class='inline'></div></span>
229
+
230
+ </li>
231
+
232
+
233
+ </ul>
234
+
235
+
236
+
237
+
238
+ <div id="constructor_details" class="method_details_list">
239
+ <h2>Constructor Details</h2>
240
+
241
+ <div class="method_details first">
242
+ <h3 class="signature first" id="initialize-instance_method">
243
+
244
+ #<strong>initialize</strong>(attributes = {}) &#x21d2; <tt><span class='object_link'><a href="" title="OptionLab::Models::ArrayInputs (class)">ArrayInputs</a></span></tt>
245
+
246
+
247
+
248
+
249
+
250
+ </h3><div class="docstring">
251
+ <div class="discussion">
252
+ <p>Returns a new instance of ArrayInputs.</p>
253
+
254
+
255
+ </div>
256
+ </div>
257
+ <div class="tags">
258
+
259
+
260
+ </div><table class="source_code">
261
+ <tr>
262
+ <td>
263
+ <pre class="lines">
264
+
265
+
266
+ 508
267
+ 509
268
+ 510
269
+ 511
270
+ 512
271
+ 513
272
+ 514
273
+ 515
274
+ 516
275
+ 517
276
+ 518
277
+ 519
278
+ 520</pre>
279
+ </td>
280
+ <td>
281
+ <pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 508</span>
282
+
283
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
284
+ <span class='comment'># Set defaults
285
+ </span> <span class='ivar'>@model</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>array</span><span class='tstring_end'>&#39;</span></span>
286
+
287
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span><span class='rparen'>)</span>
288
+
289
+ <span class='comment'># Convert array to Numo::DFloat
290
+ </span> <span class='kw'>if</span> <span class='ivar'>@array</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
291
+ <span class='ivar'>@array</span> <span class='op'>=</span> <span class='const'>Numo</span><span class='op'>::</span><span class='const'>DFloat</span><span class='period'>.</span><span class='id identifier rubyid_cast'>cast</span><span class='lparen'>(</span><span class='ivar'>@array</span><span class='rparen'>)</span>
292
+ <span class='kw'>end</span>
293
+
294
+ <span class='id identifier rubyid_validate!'>validate!</span>
295
+ <span class='kw'>end</span></pre>
296
+ </td>
297
+ </tr>
298
+ </table>
299
+ </div>
300
+
301
+ </div>
302
+
303
+ <div id="instance_attr_details" class="attr_details">
304
+ <h2>Instance Attribute Details</h2>
305
+
306
+
307
+ <span id="array=-instance_method"></span>
308
+ <div class="method_details first">
309
+ <h3 class="signature first" id="array-instance_method">
310
+
311
+ #<strong>array</strong> &#x21d2; <tt>Object</tt>
312
+
313
+
314
+
315
+
316
+
317
+ </h3><div class="docstring">
318
+ <div class="discussion">
319
+ <p>Returns the value of attribute array.</p>
320
+
321
+
322
+ </div>
323
+ </div>
324
+ <div class="tags">
325
+
326
+
327
+ </div><table class="source_code">
328
+ <tr>
329
+ <td>
330
+ <pre class="lines">
331
+
332
+
333
+ 506
334
+ 507
335
+ 508</pre>
336
+ </td>
337
+ <td>
338
+ <pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 506</span>
339
+
340
+ <span class='kw'>def</span> <span class='id identifier rubyid_array'>array</span>
341
+ <span class='ivar'>@array</span>
342
+ <span class='kw'>end</span></pre>
343
+ </td>
344
+ </tr>
345
+ </table>
346
+ </div>
347
+
348
+
349
+ <span id="model=-instance_method"></span>
350
+ <div class="method_details ">
351
+ <h3 class="signature " id="model-instance_method">
352
+
353
+ #<strong>model</strong> &#x21d2; <tt>Object</tt>
354
+
355
+
356
+
357
+
358
+
359
+ </h3><div class="docstring">
360
+ <div class="discussion">
361
+ <p>Returns the value of attribute model.</p>
362
+
363
+
364
+ </div>
365
+ </div>
366
+ <div class="tags">
367
+
368
+
369
+ </div><table class="source_code">
370
+ <tr>
371
+ <td>
372
+ <pre class="lines">
373
+
374
+
375
+ 506
376
+ 507
377
+ 508</pre>
378
+ </td>
379
+ <td>
380
+ <pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 506</span>
381
+
382
+ <span class='kw'>def</span> <span class='id identifier rubyid_model'>model</span>
383
+ <span class='ivar'>@model</span>
384
+ <span class='kw'>end</span></pre>
385
+ </td>
386
+ </tr>
387
+ </table>
388
+ </div>
389
+
390
+ </div>
391
+
392
+
393
+ <div id="instance_method_details" class="method_details_list">
394
+ <h2>Instance Method Details</h2>
395
+
396
+
397
+ <div class="method_details first">
398
+ <h3 class="signature first" id="validate!-instance_method">
399
+
400
+ #<strong>validate!</strong> &#x21d2; <tt>Object</tt>
401
+
402
+
403
+
404
+
405
+
406
+ </h3><div class="docstring">
407
+ <div class="discussion">
408
+
409
+
410
+ </div>
411
+ </div>
412
+ <div class="tags">
413
+
414
+ <p class="tag_title">Raises:</p>
415
+ <ul class="raise">
416
+
417
+ <li>
418
+
419
+
420
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
421
+
422
+
423
+
424
+ </li>
425
+
426
+ </ul>
427
+
428
+ </div><table class="source_code">
429
+ <tr>
430
+ <td>
431
+ <pre class="lines">
432
+
433
+
434
+ 522
435
+ 523
436
+ 524
437
+ 525</pre>
438
+ </td>
439
+ <td>
440
+ <pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 522</span>
441
+
442
+ <span class='kw'>def</span> <span class='id identifier rubyid_validate!'>validate!</span>
443
+ <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'>model must be &#39;array&#39;</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_model'>model</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>array</span><span class='tstring_end'>&#39;</span></span>
444
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>The array is empty!</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_array'>array</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
445
+ <span class='kw'>end</span></pre>
446
+ </td>
447
+ </tr>
448
+ </table>
449
+ </div>
450
+
451
+ </div>
452
+
453
+ </div>
454
+
455
+ <div id="footer">
456
+ Generated on Sun Apr 27 16:09:34 2025 by
457
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
458
+ 0.9.37 (ruby-3.3.3).
459
+ </div>
460
+
461
+ </div>
462
+ </body>
463
+ </html>
@@ -0,0 +1,223 @@
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
+ Class: OptionLab::Models::BaseModel
8
+
9
+ &mdash; OptionLab Documentation
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 = "OptionLab::Models::BaseModel";
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 class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (B)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../OptionLab.html" title="OptionLab (module)">OptionLab</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Models.html" title="OptionLab::Models (module)">Models</a></span></span>
41
+ &raquo;
42
+ <span class="title">BaseModel</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: OptionLab::Models::BaseModel
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">OptionLab::Models::BaseModel</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/option_lab/models.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p>Base class for all model classes</p>
105
+
106
+
107
+ </div>
108
+ </div>
109
+ <div class="tags">
110
+
111
+
112
+ </div><div id="subclasses">
113
+ <h2>Direct Known Subclasses</h2>
114
+ <p class="children"><span class='object_link'><a href="AmericanModelInputs.html" title="OptionLab::Models::AmericanModelInputs (class)">AmericanModelInputs</a></span>, <span class='object_link'><a href="ArrayInputs.html" title="OptionLab::Models::ArrayInputs (class)">ArrayInputs</a></span>, <span class='object_link'><a href="BinomialModelInputs.html" title="OptionLab::Models::BinomialModelInputs (class)">BinomialModelInputs</a></span>, <span class='object_link'><a href="BlackScholesInfo.html" title="OptionLab::Models::BlackScholesInfo (class)">BlackScholesInfo</a></span>, <span class='object_link'><a href="BlackScholesModelInputs.html" title="OptionLab::Models::BlackScholesModelInputs (class)">BlackScholesModelInputs</a></span>, <span class='object_link'><a href="ClosedPosition.html" title="OptionLab::Models::ClosedPosition (class)">ClosedPosition</a></span>, <span class='object_link'><a href="EngineData.html" title="OptionLab::Models::EngineData (class)">EngineData</a></span>, <span class='object_link'><a href="EngineDataResults.html" title="OptionLab::Models::EngineDataResults (class)">EngineDataResults</a></span>, <span class='object_link'><a href="Inputs.html" title="OptionLab::Models::Inputs (class)">Inputs</a></span>, <span class='object_link'><a href="LaplaceInputs.html" title="OptionLab::Models::LaplaceInputs (class)">LaplaceInputs</a></span>, <span class='object_link'><a href="Option.html" title="OptionLab::Models::Option (class)">Option</a></span>, <span class='object_link'><a href="Outputs.html" title="OptionLab::Models::Outputs (class)">Outputs</a></span>, <span class='object_link'><a href="PoPOutputs.html" title="OptionLab::Models::PoPOutputs (class)">PoPOutputs</a></span>, <span class='object_link'><a href="PricingResult.html" title="OptionLab::Models::PricingResult (class)">PricingResult</a></span>, <span class='object_link'><a href="Stock.html" title="OptionLab::Models::Stock (class)">Stock</a></span>, <span class='object_link'><a href="TreeVisualization.html" title="OptionLab::Models::TreeVisualization (class)">TreeVisualization</a></span></p>
115
+ </div>
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <h2>
125
+ Instance Method Summary
126
+ <small><a href="#" class="summary_toggle">collapse</a></small>
127
+ </h2>
128
+
129
+ <ul class="summary">
130
+
131
+ <li class="public ">
132
+ <span class="summary_signature">
133
+
134
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(attributes = {}) &#x21d2; BaseModel </a>
135
+
136
+
137
+
138
+ </span>
139
+
140
+
141
+ <span class="note title constructor">constructor</span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'><p>A new instance of BaseModel.</p>
151
+ </div></span>
152
+
153
+ </li>
154
+
155
+
156
+ </ul>
157
+
158
+
159
+ <div id="constructor_details" class="method_details_list">
160
+ <h2>Constructor Details</h2>
161
+
162
+ <div class="method_details first">
163
+ <h3 class="signature first" id="initialize-instance_method">
164
+
165
+ #<strong>initialize</strong>(attributes = {}) &#x21d2; <tt><span class='object_link'><a href="" title="OptionLab::Models::BaseModel (class)">BaseModel</a></span></tt>
166
+
167
+
168
+
169
+
170
+
171
+ </h3><div class="docstring">
172
+ <div class="discussion">
173
+ <p>Returns a new instance of BaseModel.</p>
174
+
175
+
176
+ </div>
177
+ </div>
178
+ <div class="tags">
179
+
180
+
181
+ </div><table class="source_code">
182
+ <tr>
183
+ <td>
184
+ <pre class="lines">
185
+
186
+
187
+ 23
188
+ 24
189
+ 25
190
+ 26
191
+ 27
192
+ 28
193
+ 29</pre>
194
+ </td>
195
+ <td>
196
+ <pre class="code"><span class="info file"># File 'lib/option_lab/models.rb', line 23</span>
197
+
198
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
199
+ <span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
200
+ <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
201
+ <span class='kw'>end</span>
202
+
203
+ <span class='id identifier rubyid_validate!'>validate!</span> <span class='kw'>if</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:validate!</span><span class='rparen'>)</span>
204
+ <span class='kw'>end</span></pre>
205
+ </td>
206
+ </tr>
207
+ </table>
208
+ </div>
209
+
210
+ </div>
211
+
212
+
213
+ </div>
214
+
215
+ <div id="footer">
216
+ Generated on Sun Apr 27 16:09:34 2025 by
217
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
218
+ 0.9.37 (ruby-3.3.3).
219
+ </div>
220
+
221
+ </div>
222
+ </body>
223
+ </html>