anchormodel 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,615 @@
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: Anchormodel::ActiveModelTypeValueSingle
8
+
9
+ &mdash; Documentation by YARD 0.9.28
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 = "Anchormodel::ActiveModelTypeValueSingle";
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="../Anchormodel.html" title="Anchormodel (class)">Anchormodel</a></span></span>
41
+ &raquo;
42
+ <span class="title">ActiveModelTypeValueSingle</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: Anchormodel::ActiveModelTypeValueSingle
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">ActiveModel::Type::Value</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">ActiveModel::Type::Value</li>
78
+
79
+ <li class="next">Anchormodel::ActiveModelTypeValueSingle</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/anchormodel/active_model_type_value_single.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ <p class="tag_title">See Also:</p>
114
+ <ul class="see">
115
+
116
+ <li><a href="https://www.rubydoc.info/docs/rails/ActiveModel/Type/Value" target="_parent" title="https://www.rubydoc.info/docs/rails/ActiveModel/Type/Value">https://www.rubydoc.info/docs/rails/ActiveModel/Type/Value</a></li>
117
+
118
+ </ul>
119
+
120
+ </div>
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <h2>
129
+ Instance Method Summary
130
+ <small><a href="#" class="summary_toggle">collapse</a></small>
131
+ </h2>
132
+
133
+ <ul class="summary">
134
+
135
+ <li class="public ">
136
+ <span class="summary_signature">
137
+
138
+ <a href="#cast-instance_method" title="#cast (instance method)">#<strong>cast</strong>(value) &#x21d2; Object </a>
139
+
140
+
141
+
142
+ </span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'>
153
+ <p>This converts an Anchormodel instance to string for DB.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ <li class="public ">
160
+ <span class="summary_signature">
161
+
162
+ <a href="#changed_in_place%3F-instance_method" title="#changed_in_place? (instance method)">#<strong>changed_in_place?</strong>(raw_old_value, value) &#x21d2; Boolean </a>
163
+
164
+
165
+
166
+ </span>
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+ <span class="summary_desc"><div class='inline'></div></span>
177
+
178
+ </li>
179
+
180
+
181
+ <li class="public ">
182
+ <span class="summary_signature">
183
+
184
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(attribute) &#x21d2; ActiveModelTypeValueSingle </a>
185
+
186
+
187
+
188
+ </span>
189
+
190
+
191
+ <span class="note title constructor">constructor</span>
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+ <span class="summary_desc"><div class='inline'>
201
+ <p>A new instance of ActiveModelTypeValueSingle.</p>
202
+ </div></span>
203
+
204
+ </li>
205
+
206
+
207
+ <li class="public ">
208
+ <span class="summary_signature">
209
+
210
+ <a href="#serializable%3F-instance_method" title="#serializable? (instance method)">#<strong>serializable?</strong>(value) &#x21d2; Boolean </a>
211
+
212
+
213
+
214
+ </span>
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+ <span class="summary_desc"><div class='inline'></div></span>
225
+
226
+ </li>
227
+
228
+
229
+ <li class="public ">
230
+ <span class="summary_signature">
231
+
232
+ <a href="#serialize-instance_method" title="#serialize (instance method)">#<strong>serialize</strong>(value) &#x21d2; Object </a>
233
+
234
+
235
+
236
+ </span>
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+ <span class="summary_desc"><div class='inline'>
247
+ <p>This converts DB or input to an Anchormodel instance.</p>
248
+ </div></span>
249
+
250
+ </li>
251
+
252
+
253
+ <li class="public ">
254
+ <span class="summary_signature">
255
+
256
+ <a href="#type-instance_method" title="#type (instance method)">#<strong>type</strong> &#x21d2; Object </a>
257
+
258
+
259
+
260
+ </span>
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+ <span class="summary_desc"><div class='inline'></div></span>
271
+
272
+ </li>
273
+
274
+
275
+ </ul>
276
+
277
+
278
+
279
+ <div id="constructor_details" class="method_details_list">
280
+ <h2>Constructor Details</h2>
281
+
282
+ <div class="method_details first">
283
+ <h3 class="signature first" id="initialize-instance_method">
284
+
285
+ #<strong>initialize</strong>(attribute) &#x21d2; <tt><span class='object_link'><a href="" title="Anchormodel::ActiveModelTypeValueSingle (class)">ActiveModelTypeValueSingle</a></span></tt>
286
+
287
+
288
+
289
+
290
+
291
+ </h3><div class="docstring">
292
+ <div class="discussion">
293
+
294
+ <p>Returns a new instance of ActiveModelTypeValueSingle.</p>
295
+
296
+
297
+ </div>
298
+ </div>
299
+ <div class="tags">
300
+
301
+
302
+ </div><table class="source_code">
303
+ <tr>
304
+ <td>
305
+ <pre class="lines">
306
+
307
+
308
+ 3
309
+ 4
310
+ 5
311
+ 6</pre>
312
+ </td>
313
+ <td>
314
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_single.rb', line 3</span>
315
+
316
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span>
317
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='rparen'>)</span>
318
+ <span class='ivar'>@attribute</span> <span class='op'>=</span> <span class='id identifier rubyid_attribute'>attribute</span>
319
+ <span class='kw'>end</span></pre>
320
+ </td>
321
+ </tr>
322
+ </table>
323
+ </div>
324
+
325
+ </div>
326
+
327
+
328
+ <div id="instance_method_details" class="method_details_list">
329
+ <h2>Instance Method Details</h2>
330
+
331
+
332
+ <div class="method_details first">
333
+ <h3 class="signature first" id="cast-instance_method">
334
+
335
+ #<strong>cast</strong>(value) &#x21d2; <tt>Object</tt>
336
+
337
+
338
+
339
+
340
+
341
+ </h3><div class="docstring">
342
+ <div class="discussion">
343
+
344
+ <p>This converts an Anchormodel instance to string for DB</p>
345
+
346
+
347
+ </div>
348
+ </div>
349
+ <div class="tags">
350
+
351
+
352
+ </div><table class="source_code">
353
+ <tr>
354
+ <td>
355
+ <pre class="lines">
356
+
357
+
358
+ 13
359
+ 14
360
+ 15
361
+ 16
362
+ 17</pre>
363
+ </td>
364
+ <td>
365
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_single.rb', line 13</span>
366
+
367
+ <span class='kw'>def</span> <span class='id identifier rubyid_cast'>cast</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
368
+ <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span>
369
+ <span class='kw'>return</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span><span class='rparen'>)</span>
370
+ <span class='kw'>return</span> <span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
371
+ <span class='kw'>end</span></pre>
372
+ </td>
373
+ </tr>
374
+ </table>
375
+ </div>
376
+
377
+ <div class="method_details ">
378
+ <h3 class="signature " id="changed_in_place?-instance_method">
379
+
380
+ #<strong>changed_in_place?</strong>(raw_old_value, value) &#x21d2; <tt>Boolean</tt>
381
+
382
+
383
+
384
+
385
+
386
+ </h3><div class="docstring">
387
+ <div class="discussion">
388
+
389
+
390
+ </div>
391
+ </div>
392
+ <div class="tags">
393
+
394
+ <p class="tag_title">Returns:</p>
395
+ <ul class="return">
396
+
397
+ <li>
398
+
399
+
400
+ <span class='type'>(<tt>Boolean</tt>)</span>
401
+
402
+
403
+
404
+ </li>
405
+
406
+ </ul>
407
+
408
+ </div><table class="source_code">
409
+ <tr>
410
+ <td>
411
+ <pre class="lines">
412
+
413
+
414
+ 48
415
+ 49
416
+ 50
417
+ 51</pre>
418
+ </td>
419
+ <td>
420
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_single.rb', line 48</span>
421
+
422
+ <span class='kw'>def</span> <span class='id identifier rubyid_changed_in_place?'>changed_in_place?</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_old_value'>raw_old_value</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
423
+ <span class='id identifier rubyid_old_value'>old_value</span> <span class='op'>=</span> <span class='id identifier rubyid_deserialize'>deserialize</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_old_value'>raw_old_value</span><span class='rparen'>)</span>
424
+ <span class='id identifier rubyid_old_value'>old_value</span> <span class='op'>!=</span> <span class='id identifier rubyid_value'>value</span>
425
+ <span class='kw'>end</span></pre>
426
+ </td>
427
+ </tr>
428
+ </table>
429
+ </div>
430
+
431
+ <div class="method_details ">
432
+ <h3 class="signature " id="serializable?-instance_method">
433
+
434
+ #<strong>serializable?</strong>(value) &#x21d2; <tt>Boolean</tt>
435
+
436
+
437
+
438
+
439
+
440
+ </h3><div class="docstring">
441
+ <div class="discussion">
442
+
443
+
444
+ </div>
445
+ </div>
446
+ <div class="tags">
447
+
448
+ <p class="tag_title">Returns:</p>
449
+ <ul class="return">
450
+
451
+ <li>
452
+
453
+
454
+ <span class='type'>(<tt>Boolean</tt>)</span>
455
+
456
+
457
+
458
+ </li>
459
+
460
+ </ul>
461
+
462
+ </div><table class="source_code">
463
+ <tr>
464
+ <td>
465
+ <pre class="lines">
466
+
467
+
468
+ 37
469
+ 38
470
+ 39
471
+ 40
472
+ 41
473
+ 42
474
+ 43
475
+ 44
476
+ 45
477
+ 46</pre>
478
+ </td>
479
+ <td>
480
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_single.rb', line 37</span>
481
+
482
+ <span class='kw'>def</span> <span class='id identifier rubyid_serializable?'>serializable?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
483
+ <span class='kw'>return</span> <span class='kw'>case</span> <span class='id identifier rubyid_value'>value</span>
484
+ <span class='kw'>when</span> <span class='const'>Symbol</span><span class='comma'>,</span> <span class='const'>String</span>
485
+ <span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span><span class='period'>.</span><span class='id identifier rubyid_valid_keys'>valid_keys</span><span class='period'>.</span><span class='id identifier rubyid_exclude?'>exclude?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span>
486
+ <span class='kw'>when</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span>
487
+ <span class='kw'>true</span>
488
+ <span class='kw'>else</span>
489
+ <span class='kw'>false</span>
490
+ <span class='kw'>end</span>
491
+ <span class='kw'>end</span></pre>
492
+ </td>
493
+ </tr>
494
+ </table>
495
+ </div>
496
+
497
+ <div class="method_details ">
498
+ <h3 class="signature " id="serialize-instance_method">
499
+
500
+ #<strong>serialize</strong>(value) &#x21d2; <tt>Object</tt>
501
+
502
+
503
+
504
+
505
+
506
+ </h3><div class="docstring">
507
+ <div class="discussion">
508
+
509
+ <p>This converts DB or input to an Anchormodel instance</p>
510
+
511
+
512
+ </div>
513
+ </div>
514
+ <div class="tags">
515
+
516
+
517
+ </div><table class="source_code">
518
+ <tr>
519
+ <td>
520
+ <pre class="lines">
521
+
522
+
523
+ 20
524
+ 21
525
+ 22
526
+ 23
527
+ 24
528
+ 25
529
+ 26
530
+ 27
531
+ 28
532
+ 29
533
+ 30
534
+ 31
535
+ 32
536
+ 33
537
+ 34
538
+ 35</pre>
539
+ </td>
540
+ <td>
541
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_single.rb', line 20</span>
542
+
543
+ <span class='kw'>def</span> <span class='id identifier rubyid_serialize'>serialize</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
544
+ <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_presence'>presence</span>
545
+ <span class='kw'>return</span> <span class='kw'>case</span> <span class='id identifier rubyid_value'>value</span>
546
+ <span class='kw'>when</span> <span class='const'>Symbol</span><span class='comma'>,</span> <span class='const'>String</span>
547
+ <span class='kw'>unless</span> <span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span><span class='period'>.</span><span class='id identifier rubyid_valid_keys'>valid_keys</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span>
548
+ <span class='id identifier rubyid_fail'>fail</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Attempt to set </span><span class='embexpr_beg'>#{</span><span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> to unsupported key </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
549
+ <span class='kw'>end</span>
550
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
551
+ <span class='kw'>when</span> <span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_anchormodel_class'>anchormodel_class</span>
552
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
553
+ <span class='kw'>when</span> <span class='kw'>nil</span>
554
+ <span class='kw'>nil</span>
555
+ <span class='kw'>else</span>
556
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Attempt to set </span><span class='embexpr_beg'>#{</span><span class='ivar'>@attribute</span><span class='period'>.</span><span class='id identifier rubyid_attribute_name'>attribute_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> to unsupported type </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
557
+ <span class='kw'>end</span>
558
+ <span class='kw'>end</span></pre>
559
+ </td>
560
+ </tr>
561
+ </table>
562
+ </div>
563
+
564
+ <div class="method_details ">
565
+ <h3 class="signature " id="type-instance_method">
566
+
567
+ #<strong>type</strong> &#x21d2; <tt>Object</tt>
568
+
569
+
570
+
571
+
572
+
573
+ </h3><div class="docstring">
574
+ <div class="discussion">
575
+
576
+
577
+ </div>
578
+ </div>
579
+ <div class="tags">
580
+
581
+
582
+ </div><table class="source_code">
583
+ <tr>
584
+ <td>
585
+ <pre class="lines">
586
+
587
+
588
+ 8
589
+ 9
590
+ 10</pre>
591
+ </td>
592
+ <td>
593
+ <pre class="code"><span class="info file"># File 'lib/anchormodel/active_model_type_value_single.rb', line 8</span>
594
+
595
+ <span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
596
+ <span class='symbol'>:anchormodel</span>
597
+ <span class='kw'>end</span></pre>
598
+ </td>
599
+ </tr>
600
+ </table>
601
+ </div>
602
+
603
+ </div>
604
+
605
+ </div>
606
+
607
+ <div id="footer">
608
+ Generated on Wed Apr 24 17:01:46 2024 by
609
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
610
+ 0.9.28 (ruby-3.2.2).
611
+ </div>
612
+
613
+ </div>
614
+ </body>
615
+ </html>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Anchormodel::Attribute
8
8
 
9
- &mdash; Documentation by YARD 0.9.36
9
+ &mdash; Documentation by YARD 0.9.28
10
10
 
11
11
  </title>
12
12
 
@@ -496,9 +496,9 @@
496
496
  </div>
497
497
 
498
498
  <div id="footer">
499
- Generated on Tue Apr 23 17:20:43 2024 by
499
+ Generated on Wed Apr 24 17:01:46 2024 by
500
500
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
501
- 0.9.36 (ruby-3.2.2).
501
+ 0.9.28 (ruby-3.2.2).
502
502
  </div>
503
503
 
504
504
  </div>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Anchormodel::ModelMixin
8
8
 
9
- &mdash; Documentation by YARD 0.9.36
9
+ &mdash; Documentation by YARD 0.9.28
10
10
 
11
11
  </title>
12
12
 
@@ -201,9 +201,9 @@
201
201
  </div>
202
202
 
203
203
  <div id="footer">
204
- Generated on Tue Apr 23 17:20:43 2024 by
204
+ Generated on Wed Apr 24 17:01:46 2024 by
205
205
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
206
- 0.9.36 (ruby-3.2.2).
206
+ 0.9.28 (ruby-3.2.2).
207
207
  </div>
208
208
 
209
209
  </div>