repository-base 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +27 -0
  5. data/.travis.yml +6 -0
  6. data/.yardopts +1 -0
  7. data/CHANGELOG.md +128 -0
  8. data/Gemfile +4 -0
  9. data/LICENSE +22 -0
  10. data/README.md +132 -0
  11. data/Rakefile +33 -0
  12. data/bin/bundle +105 -0
  13. data/bin/htmldiff +29 -0
  14. data/bin/kramdown +29 -0
  15. data/bin/ldiff +29 -0
  16. data/bin/rake +29 -0
  17. data/bin/rspec +29 -0
  18. data/bin/rubocop +29 -0
  19. data/bin/ruby-parse +29 -0
  20. data/bin/ruby-rewrite +29 -0
  21. data/bin/setup +43 -0
  22. data/bin/yard +29 -0
  23. data/bin/yardoc +29 -0
  24. data/bin/yri +29 -0
  25. data/doc/Repository.html +128 -0
  26. data/doc/Repository/Base.html +1248 -0
  27. data/doc/Repository/Base/Internals.html +133 -0
  28. data/doc/Repository/Base/Internals/RecordDeleter.html +687 -0
  29. data/doc/Repository/Base/Internals/RecordSaver.html +816 -0
  30. data/doc/Repository/Base/Internals/RecordUpdater.html +1026 -0
  31. data/doc/Repository/Base/Internals/SlugFinder.html +986 -0
  32. data/doc/_index.html +176 -0
  33. data/doc/class_list.html +51 -0
  34. data/doc/css/common.css +1 -0
  35. data/doc/css/full_list.css +58 -0
  36. data/doc/css/style.css +499 -0
  37. data/doc/file.CHANGELOG.html +240 -0
  38. data/doc/file.README.html +218 -0
  39. data/doc/file_list.html +61 -0
  40. data/doc/frames.html +17 -0
  41. data/doc/index.html +218 -0
  42. data/doc/js/app.js +248 -0
  43. data/doc/js/full_list.js +216 -0
  44. data/doc/js/jquery.js +4 -0
  45. data/doc/method_list.html +363 -0
  46. data/doc/top-level-namespace.html +110 -0
  47. data/lib/repository/base.rb +115 -0
  48. data/lib/repository/base/internals/internals.rb +6 -0
  49. data/lib/repository/base/internals/record_deleter.rb +46 -0
  50. data/lib/repository/base/internals/record_saver.rb +58 -0
  51. data/lib/repository/base/internals/record_updater.rb +54 -0
  52. data/lib/repository/base/internals/slug_finder.rb +70 -0
  53. data/lib/repository/base/version.rb +12 -0
  54. data/repository-base.gemspec +37 -0
  55. data/spec/repository/base_spec.rb +398 -0
  56. data/spec/spec_helper.rb +14 -0
  57. metadata +281 -0
@@ -0,0 +1,1248 @@
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: Repository::Base
8
+
9
+ &mdash; Documentation by YARD 0.9.12
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Repository::Base";
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="../Repository.html" title="Repository (module)">Repository</a></span></span>
41
+ &raquo;
42
+ <span class="title">Base</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: Repository::Base
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">Repository::Base</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <dl>
91
+ <dt>Includes:</dt>
92
+ <dd><span class='object_link'><a href="Base/Internals.html" title="Repository::Base::Internals (module)">Internals</a></span></dd>
93
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>lib/repository/base.rb<span class="defines">,<br />
103
+ lib/repository/base/internals/record_deleter.rb,<br /> lib/repository/base/internals/record_saver.rb,<br /> lib/repository/base/internals/record_updater.rb,<br /> lib/repository/base/internals/slug_finder.rb,<br /> lib/repository/base/version.rb</span>
104
+ </dd>
105
+ </dl>
106
+
107
+ </div>
108
+
109
+ <h2>Overview</h2><div class="docstring">
110
+ <div class="discussion">
111
+
112
+ <p>Base class for Repository in Data Mapper pattern.</p>
113
+
114
+
115
+ </div>
116
+ </div>
117
+ <div class="tags">
118
+
119
+
120
+ </div><h2>Defined Under Namespace</h2>
121
+ <p class="children">
122
+
123
+
124
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Base/Internals.html" title="Repository::Base::Internals (module)">Internals</a></span>
125
+
126
+
127
+
128
+
129
+ </p>
130
+
131
+ <h2>Constant Summary</h2>
132
+ <dl class="constants">
133
+
134
+ <dt id="VERSION-constant" class="">VERSION =
135
+ <div class="docstring">
136
+ <div class="discussion">
137
+
138
+ <p>Gem version, following [RubyGems.org](<a
139
+ href="https://rubygems.org">rubygems.org</a>) and [SemVer](<a
140
+ href="http://semver.org">semver.org</a>/) conventions.</p>
141
+
142
+
143
+ </div>
144
+ </div>
145
+ <div class="tags">
146
+
147
+
148
+ </div>
149
+ </dt>
150
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.4.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
151
+
152
+ </dl>
153
+
154
+
155
+
156
+
157
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
158
+ <ul class="summary">
159
+
160
+ <li class="public ">
161
+ <span class="summary_signature">
162
+
163
+ <a href="#dao-instance_method" title="#dao (instance method)">#<strong>dao</strong> &#x21d2; Object </a>
164
+
165
+
166
+
167
+ </span>
168
+
169
+
170
+
171
+
172
+ <span class="note title readonly">readonly</span>
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+ <span class="summary_desc"><div class='inline'>
183
+ <p>Returns the value of attribute dao.</p>
184
+ </div></span>
185
+
186
+ </li>
187
+
188
+
189
+ <li class="public ">
190
+ <span class="summary_signature">
191
+
192
+ <a href="#factory-instance_method" title="#factory (instance method)">#<strong>factory</strong> &#x21d2; Object </a>
193
+
194
+
195
+
196
+ </span>
197
+
198
+
199
+
200
+
201
+ <span class="note title readonly">readonly</span>
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ <span class="summary_desc"><div class='inline'>
212
+ <p>Returns the value of attribute factory.</p>
213
+ </div></span>
214
+
215
+ </li>
216
+
217
+
218
+ </ul>
219
+
220
+
221
+
222
+
223
+
224
+ <h2>
225
+ Instance Method Summary
226
+ <small><a href="#" class="summary_toggle">collapse</a></small>
227
+ </h2>
228
+
229
+ <ul class="summary">
230
+
231
+ <li class="public ">
232
+ <span class="summary_signature">
233
+
234
+ <a href="#add-instance_method" title="#add (instance method)">#<strong>add</strong>(entity) &#x21d2; Repository::Support::StoreResult </a>
235
+
236
+
237
+
238
+ </span>
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'>
249
+ <p>Add a new record with attributes matching the specified entity to the
250
+ associated DAO.</p>
251
+ </div></span>
252
+
253
+ </li>
254
+
255
+
256
+ <li class="public ">
257
+ <span class="summary_signature">
258
+
259
+ <a href="#all-instance_method" title="#all (instance method)">#<strong>all</strong> &#x21d2; Array </a>
260
+
261
+
262
+
263
+ </span>
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+ <span class="summary_desc"><div class='inline'>
274
+ <p>Return an array of entities matching all records currently in the
275
+ associated DAO.</p>
276
+ </div></span>
277
+
278
+ </li>
279
+
280
+
281
+ <li class="public ">
282
+ <span class="summary_signature">
283
+
284
+ <a href="#delete-instance_method" title="#delete (instance method)">#<strong>delete</strong>(identifier) &#x21d2; Repository::Support::StoreResult </a>
285
+
286
+
287
+
288
+ </span>
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+ <span class="summary_desc"><div class='inline'>
299
+ <p>Remove a record from the underlying DAO whose slug matches the passed-in
300
+ identifier.</p>
301
+ </div></span>
302
+
303
+ </li>
304
+
305
+
306
+ <li class="private ">
307
+ <span class="summary_signature">
308
+
309
+ <a href="#filtered_attributes_for-instance_method" title="#filtered_attributes_for (instance method)">#<strong>filtered_attributes_for</strong>(entity) &#x21d2; Object </a>
310
+
311
+
312
+
313
+ </span>
314
+
315
+
316
+
317
+ <span class="note title private">private</span>
318
+
319
+
320
+
321
+
322
+
323
+ <span class="summary_desc"><div class='inline'>
324
+ <p>supporting #add.</p>
325
+ </div></span>
326
+
327
+ </li>
328
+
329
+
330
+ <li class="public ">
331
+ <span class="summary_signature">
332
+
333
+ <a href="#find_by_slug-instance_method" title="#find_by_slug (instance method)">#<strong>find_by_slug</strong>(slug) &#x21d2; Repository::Support::StoreResult </a>
334
+
335
+
336
+
337
+ </span>
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+ <span class="summary_desc"><div class='inline'>
348
+ <p>Find a record in the DAO and, on success, return a corresponding entity
349
+ using the specified [slug](<a
350
+ href="http://en.wikipedia.org/wiki/Semantic_URL#Slug">en.wikipedia.org/wiki/Semantic_URL#Slug</a>),
351
+ <strong>not</strong> a numeric record ID, as a search identifier.</p>
352
+ </div></span>
353
+
354
+ </li>
355
+
356
+
357
+ <li class="public ">
358
+ <span class="summary_signature">
359
+
360
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(factory:, dao:) &#x21d2; Base </a>
361
+
362
+
363
+
364
+ </span>
365
+
366
+
367
+ <span class="note title constructor">constructor</span>
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+ <span class="summary_desc"><div class='inline'>
377
+ <p>Initialise a new `Repository::Base` instance.</p>
378
+ </div></span>
379
+
380
+ </li>
381
+
382
+
383
+ <li class="public ">
384
+ <span class="summary_signature">
385
+
386
+ <a href="#update-instance_method" title="#update (instance method)">#<strong>update</strong>(identifier:, updated_attrs:) &#x21d2; Object </a>
387
+
388
+
389
+
390
+ </span>
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+ <span class="summary_desc"><div class='inline'>
401
+ <p>Update a record in the DAO corresponding to the specified identifier, using
402
+ the specified attribute-name/value pairs.</p>
403
+ </div></span>
404
+
405
+ </li>
406
+
407
+
408
+ <li class="private ">
409
+ <span class="summary_signature">
410
+
411
+ <a href="#validate_initializer_argument-instance_method" title="#validate_initializer_argument (instance method)">#<strong>validate_initializer_argument</strong>(arg_sym, value) &#x21d2; boolean </a>
412
+
413
+
414
+
415
+ </span>
416
+
417
+
418
+
419
+ <span class="note title private">private</span>
420
+
421
+
422
+
423
+
424
+
425
+ <span class="summary_desc"><div class='inline'>
426
+ <p>Verifies that parameter passed to #initialize is a Class.</p>
427
+ </div></span>
428
+
429
+ </li>
430
+
431
+
432
+ </ul>
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+ <div id="constructor_details" class="method_details_list">
442
+ <h2>Constructor Details</h2>
443
+
444
+ <div class="method_details first">
445
+ <h3 class="signature first" id="initialize-instance_method">
446
+
447
+ #<strong>initialize</strong>(factory:, dao:) &#x21d2; <tt><span class='object_link'><a href="" title="Repository::Base (class)">Base</a></span></tt>
448
+
449
+
450
+
451
+
452
+
453
+ </h3><div class="docstring">
454
+ <div class="discussion">
455
+
456
+ <p>Initialise a new `Repository::Base` instance.</p>
457
+
458
+
459
+ </div>
460
+ </div>
461
+ <div class="tags">
462
+ <p class="tag_title">Parameters:</p>
463
+ <ul class="param">
464
+
465
+ <li>
466
+
467
+ <span class='name'>factory</span>
468
+
469
+
470
+ <span class='type'></span>
471
+
472
+
473
+
474
+ &mdash;
475
+ <div class='inline'>
476
+ <p>Has a .create method to create entities from DAO records.</p>
477
+ </div>
478
+
479
+ </li>
480
+
481
+ <li>
482
+
483
+ <span class='name'>dao</span>
484
+
485
+
486
+ <span class='type'></span>
487
+
488
+
489
+
490
+ &mdash;
491
+ <div class='inline'>
492
+ <p>Data Access Object implements persistence without business logic.</p>
493
+ </div>
494
+
495
+ </li>
496
+
497
+ </ul>
498
+
499
+
500
+ </div><table class="source_code">
501
+ <tr>
502
+ <td>
503
+ <pre class="lines">
504
+
505
+
506
+ 32
507
+ 33
508
+ 34
509
+ 35
510
+ 36
511
+ 37</pre>
512
+ </td>
513
+ <td>
514
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 32</span>
515
+
516
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>factory:</span><span class='comma'>,</span> <span class='label'>dao:</span><span class='rparen'>)</span>
517
+ <span class='id identifier rubyid_validate_initializer_argument'>validate_initializer_argument</span><span class='lparen'>(</span><span class='symbol'>:dao</span><span class='comma'>,</span> <span class='id identifier rubyid_dao'>dao</span><span class='rparen'>)</span>
518
+ <span class='id identifier rubyid_validate_initializer_argument'>validate_initializer_argument</span><span class='lparen'>(</span><span class='symbol'>:factory</span><span class='comma'>,</span> <span class='id identifier rubyid_factory'>factory</span><span class='rparen'>)</span>
519
+ <span class='ivar'>@factory</span> <span class='op'>=</span> <span class='id identifier rubyid_factory'>factory</span>
520
+ <span class='ivar'>@dao</span> <span class='op'>=</span> <span class='id identifier rubyid_dao'>dao</span>
521
+ <span class='kw'>end</span></pre>
522
+ </td>
523
+ </tr>
524
+ </table>
525
+ </div>
526
+
527
+ </div>
528
+
529
+ <div id="instance_attr_details" class="attr_details">
530
+ <h2>Instance Attribute Details</h2>
531
+
532
+
533
+ <span id=""></span>
534
+ <div class="method_details first">
535
+ <h3 class="signature first" id="dao-instance_method">
536
+
537
+ #<strong>dao</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
538
+
539
+
540
+
541
+
542
+
543
+ </h3><div class="docstring">
544
+ <div class="discussion">
545
+
546
+ <p>Returns the value of attribute dao</p>
547
+
548
+
549
+ </div>
550
+ </div>
551
+ <div class="tags">
552
+
553
+
554
+ </div><table class="source_code">
555
+ <tr>
556
+ <td>
557
+ <pre class="lines">
558
+
559
+
560
+ 26
561
+ 27
562
+ 28</pre>
563
+ </td>
564
+ <td>
565
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 26</span>
566
+
567
+ <span class='kw'>def</span> <span class='id identifier rubyid_dao'>dao</span>
568
+ <span class='ivar'>@dao</span>
569
+ <span class='kw'>end</span></pre>
570
+ </td>
571
+ </tr>
572
+ </table>
573
+ </div>
574
+
575
+
576
+ <span id=""></span>
577
+ <div class="method_details ">
578
+ <h3 class="signature " id="factory-instance_method">
579
+
580
+ #<strong>factory</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
581
+
582
+
583
+
584
+
585
+
586
+ </h3><div class="docstring">
587
+ <div class="discussion">
588
+
589
+ <p>Returns the value of attribute factory</p>
590
+
591
+
592
+ </div>
593
+ </div>
594
+ <div class="tags">
595
+
596
+
597
+ </div><table class="source_code">
598
+ <tr>
599
+ <td>
600
+ <pre class="lines">
601
+
602
+
603
+ 26
604
+ 27
605
+ 28</pre>
606
+ </td>
607
+ <td>
608
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 26</span>
609
+
610
+ <span class='kw'>def</span> <span class='id identifier rubyid_factory'>factory</span>
611
+ <span class='ivar'>@factory</span>
612
+ <span class='kw'>end</span></pre>
613
+ </td>
614
+ </tr>
615
+ </table>
616
+ </div>
617
+
618
+ </div>
619
+
620
+
621
+ <div id="instance_method_details" class="method_details_list">
622
+ <h2>Instance Method Details</h2>
623
+
624
+
625
+ <div class="method_details first">
626
+ <h3 class="signature first" id="add-instance_method">
627
+
628
+ #<strong>add</strong>(entity) &#x21d2; <tt>Repository::Support::StoreResult</tt>
629
+
630
+
631
+
632
+
633
+
634
+ </h3><div class="docstring">
635
+ <div class="discussion">
636
+
637
+ <p>Add a new record with attributes matching the specified entity to the
638
+ associated DAO.</p>
639
+
640
+
641
+ </div>
642
+ </div>
643
+ <div class="tags">
644
+ <p class="tag_title">Parameters:</p>
645
+ <ul class="param">
646
+
647
+ <li>
648
+
649
+ <span class='name'>entity</span>
650
+
651
+
652
+ <span class='type'></span>
653
+
654
+
655
+
656
+ &mdash;
657
+ <div class='inline'>
658
+ <p>Entity specifying record to be persisted to new DAO record.</p>
659
+ </div>
660
+
661
+ </li>
662
+
663
+ </ul>
664
+
665
+ <p class="tag_title">Returns:</p>
666
+ <ul class="return">
667
+
668
+ <li>
669
+
670
+
671
+ <span class='type'>(<tt>Repository::Support::StoreResult</tt>)</span>
672
+
673
+
674
+
675
+ &mdash;
676
+ <div class='inline'>
677
+ <p>An object containing information about the success or failure of an action.</p>
678
+ </div>
679
+
680
+ </li>
681
+
682
+ </ul>
683
+
684
+ </div><table class="source_code">
685
+ <tr>
686
+ <td>
687
+ <pre class="lines">
688
+
689
+
690
+ 44
691
+ 45
692
+ 46
693
+ 47</pre>
694
+ </td>
695
+ <td>
696
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 44</span>
697
+
698
+ <span class='kw'>def</span> <span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_entity'>entity</span><span class='rparen'>)</span>
699
+ <span class='id identifier rubyid_record'>record</span> <span class='op'>=</span> <span class='id identifier rubyid_dao'>dao</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_filtered_attributes_for'>filtered_attributes_for</span><span class='lparen'>(</span><span class='id identifier rubyid_entity'>entity</span><span class='rparen'>)</span>
700
+ <span class='const'><span class='object_link'><a href="Base/Internals/RecordSaver.html" title="Repository::Base::Internals::RecordSaver (class)">RecordSaver</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Base/Internals/RecordSaver.html#initialize-instance_method" title="Repository::Base::Internals::RecordSaver#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>record:</span> <span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='label'>factory:</span> <span class='id identifier rubyid_factory'>factory</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_result'><span class='object_link'><a href="Base/Internals/RecordSaver.html#result-instance_method" title="Repository::Base::Internals::RecordSaver#result (method)">result</a></span></span>
701
+ <span class='kw'>end</span></pre>
702
+ </td>
703
+ </tr>
704
+ </table>
705
+ </div>
706
+
707
+ <div class="method_details ">
708
+ <h3 class="signature " id="all-instance_method">
709
+
710
+ #<strong>all</strong> &#x21d2; <tt>Array</tt>
711
+
712
+
713
+
714
+
715
+
716
+ </h3><div class="docstring">
717
+ <div class="discussion">
718
+
719
+ <p>Return an array of entities matching all records currently in the
720
+ associated DAO.</p>
721
+
722
+
723
+ </div>
724
+ </div>
725
+ <div class="tags">
726
+
727
+ <p class="tag_title">Returns:</p>
728
+ <ul class="return">
729
+
730
+ <li>
731
+
732
+
733
+ <span class='type'>(<tt>Array</tt>)</span>
734
+
735
+
736
+
737
+ &mdash;
738
+ <div class='inline'>
739
+ <p>Array of entities as supplied by the `factory`.</p>
740
+ </div>
741
+
742
+ </li>
743
+
744
+ </ul>
745
+ <p class="tag_title">Since:</p>
746
+ <ul class="since">
747
+
748
+ <li>
749
+
750
+
751
+
752
+
753
+
754
+ <div class='inline'>
755
+ <p>0.0.2</p>
756
+ </div>
757
+
758
+ </li>
759
+
760
+ </ul>
761
+
762
+ </div><table class="source_code">
763
+ <tr>
764
+ <td>
765
+ <pre class="lines">
766
+
767
+
768
+ 53
769
+ 54
770
+ 55</pre>
771
+ </td>
772
+ <td>
773
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 53</span>
774
+
775
+ <span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span>
776
+ <span class='id identifier rubyid_dao'>dao</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_record'>record</span><span class='op'>|</span> <span class='id identifier rubyid_factory'>factory</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span> <span class='id identifier rubyid_record'>record</span> <span class='rbrace'>}</span>
777
+ <span class='kw'>end</span></pre>
778
+ </td>
779
+ </tr>
780
+ </table>
781
+ </div>
782
+
783
+ <div class="method_details ">
784
+ <h3 class="signature " id="delete-instance_method">
785
+
786
+ #<strong>delete</strong>(identifier) &#x21d2; <tt>Repository::Support::StoreResult</tt>
787
+
788
+
789
+
790
+
791
+
792
+ </h3><div class="docstring">
793
+ <div class="discussion">
794
+
795
+ <p>Remove a record from the underlying DAO whose slug matches the passed-in
796
+ identifier.</p>
797
+
798
+
799
+ </div>
800
+ </div>
801
+ <div class="tags">
802
+ <p class="tag_title">Parameters:</p>
803
+ <ul class="param">
804
+
805
+ <li>
806
+
807
+ <span class='name'>identifier</span>
808
+
809
+
810
+ <span class='type'>(<tt>String</tt>)</span>
811
+
812
+
813
+
814
+ &mdash;
815
+ <div class='inline'>
816
+ <p>[Slug](<a
817
+ href="http://en.wikipedia.org/wiki/Semantic_URL#Slug">en.wikipedia.org/wiki/Semantic_URL#Slug</a>)
818
+ for record to be deleted.</p>
819
+ </div>
820
+
821
+ </li>
822
+
823
+ </ul>
824
+
825
+ <p class="tag_title">Returns:</p>
826
+ <ul class="return">
827
+
828
+ <li>
829
+
830
+
831
+ <span class='type'>(<tt>Repository::Support::StoreResult</tt>)</span>
832
+
833
+
834
+
835
+ &mdash;
836
+ <div class='inline'>
837
+ <p>An object containing information about the success or failure of an action.</p>
838
+ </div>
839
+
840
+ </li>
841
+
842
+ </ul>
843
+ <p class="tag_title">Since:</p>
844
+ <ul class="since">
845
+
846
+ <li>
847
+
848
+
849
+
850
+
851
+
852
+ <div class='inline'>
853
+ <p>0.0.5</p>
854
+ </div>
855
+
856
+ </li>
857
+
858
+ </ul>
859
+
860
+ </div><table class="source_code">
861
+ <tr>
862
+ <td>
863
+ <pre class="lines">
864
+
865
+
866
+ 64
867
+ 65
868
+ 66
869
+ 67</pre>
870
+ </td>
871
+ <td>
872
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 64</span>
873
+
874
+ <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_identifier'>identifier</span><span class='rparen'>)</span>
875
+ <span class='const'><span class='object_link'><a href="Base/Internals/RecordDeleter.html" title="Repository::Base::Internals::RecordDeleter (class)">RecordDeleter</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Base/Internals/RecordDeleter.html#initialize-instance_method" title="Repository::Base::Internals::RecordDeleter#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>identifier:</span> <span class='id identifier rubyid_identifier'>identifier</span><span class='comma'>,</span> <span class='label'>dao:</span> <span class='id identifier rubyid_dao'>dao</span><span class='comma'>,</span> <span class='label'>factory:</span> <span class='id identifier rubyid_factory'>factory</span><span class='rparen'>)</span>
876
+ <span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
877
+ <span class='kw'>end</span></pre>
878
+ </td>
879
+ </tr>
880
+ </table>
881
+ </div>
882
+
883
+ <div class="method_details ">
884
+ <h3 class="signature " id="filtered_attributes_for-instance_method">
885
+
886
+ #<strong>filtered_attributes_for</strong>(entity) &#x21d2; <tt>Object</tt> <span class="extras">(private)</span>
887
+
888
+
889
+
890
+
891
+
892
+ </h3><div class="docstring">
893
+ <div class="discussion">
894
+
895
+ <p>supporting #add</p>
896
+
897
+
898
+ </div>
899
+ </div>
900
+ <div class="tags">
901
+
902
+
903
+ </div><table class="source_code">
904
+ <tr>
905
+ <td>
906
+ <pre class="lines">
907
+
908
+
909
+ 111
910
+ 112
911
+ 113</pre>
912
+ </td>
913
+ <td>
914
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 111</span>
915
+
916
+ <span class='kw'>def</span> <span class='id identifier rubyid_filtered_attributes_for'>filtered_attributes_for</span><span class='lparen'>(</span><span class='id identifier rubyid_entity'>entity</span><span class='rparen'>)</span> <span class='comment'># :nodoc:
917
+ </span> <span class='id identifier rubyid_entity'>entity</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_to_hash'>to_hash</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid__v'>_v</span><span class='op'>|</span> <span class='id identifier rubyid_k'>k</span> <span class='op'>==</span> <span class='symbol'>:errors</span> <span class='rbrace'>}</span>
918
+ <span class='kw'>end</span></pre>
919
+ </td>
920
+ </tr>
921
+ </table>
922
+ </div>
923
+
924
+ <div class="method_details ">
925
+ <h3 class="signature " id="find_by_slug-instance_method">
926
+
927
+ #<strong>find_by_slug</strong>(slug) &#x21d2; <tt>Repository::Support::StoreResult</tt>
928
+
929
+
930
+
931
+
932
+
933
+ </h3><div class="docstring">
934
+ <div class="discussion">
935
+
936
+ <p>Find a record in the DAO and, on success, return a corresponding entity
937
+ using the specified [slug](<a
938
+ href="http://en.wikipedia.org/wiki/Semantic_URL#Slug">en.wikipedia.org/wiki/Semantic_URL#Slug</a>),
939
+ <strong>not</strong> a numeric record ID, as a search identifier.</p>
940
+
941
+
942
+ </div>
943
+ </div>
944
+ <div class="tags">
945
+ <p class="tag_title">Parameters:</p>
946
+ <ul class="param">
947
+
948
+ <li>
949
+
950
+ <span class='name'>slug</span>
951
+
952
+
953
+ <span class='type'>(<tt>String</tt>)</span>
954
+
955
+
956
+
957
+ &mdash;
958
+ <div class='inline'>
959
+ <p>[Slug](<a
960
+ href="http://en.wikipedia.org/wiki/Semantic_URL#Slug">en.wikipedia.org/wiki/Semantic_URL#Slug</a>)
961
+ for record to be deleted.</p>
962
+ </div>
963
+
964
+ </li>
965
+
966
+ </ul>
967
+
968
+ <p class="tag_title">Returns:</p>
969
+ <ul class="return">
970
+
971
+ <li>
972
+
973
+
974
+ <span class='type'>(<tt>Repository::Support::StoreResult</tt>)</span>
975
+
976
+
977
+
978
+ &mdash;
979
+ <div class='inline'>
980
+ <p>An object containing information about the success or failure of an action.</p>
981
+ </div>
982
+
983
+ </li>
984
+
985
+ </ul>
986
+ <p class="tag_title">Since:</p>
987
+ <ul class="since">
988
+
989
+ <li>
990
+
991
+
992
+
993
+
994
+
995
+ <div class='inline'>
996
+ <p>0.0.3</p>
997
+ </div>
998
+
999
+ </li>
1000
+
1001
+ </ul>
1002
+
1003
+ </div><table class="source_code">
1004
+ <tr>
1005
+ <td>
1006
+ <pre class="lines">
1007
+
1008
+
1009
+ 77
1010
+ 78
1011
+ 79</pre>
1012
+ </td>
1013
+ <td>
1014
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 77</span>
1015
+
1016
+ <span class='kw'>def</span> <span class='id identifier rubyid_find_by_slug'>find_by_slug</span><span class='lparen'>(</span><span class='id identifier rubyid_slug'>slug</span><span class='rparen'>)</span>
1017
+ <span class='const'><span class='object_link'><a href="Base/Internals/SlugFinder.html" title="Repository::Base::Internals::SlugFinder (class)">SlugFinder</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Base/Internals/SlugFinder.html#initialize-instance_method" title="Repository::Base::Internals::SlugFinder#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>slug:</span> <span class='id identifier rubyid_slug'>slug</span><span class='comma'>,</span> <span class='label'>dao:</span> <span class='id identifier rubyid_dao'>dao</span><span class='comma'>,</span> <span class='label'>factory:</span> <span class='id identifier rubyid_factory'>factory</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_find'><span class='object_link'><a href="Base/Internals/SlugFinder.html#find-instance_method" title="Repository::Base::Internals::SlugFinder#find (method)">find</a></span></span>
1018
+ <span class='kw'>end</span></pre>
1019
+ </td>
1020
+ </tr>
1021
+ </table>
1022
+ </div>
1023
+
1024
+ <div class="method_details ">
1025
+ <h3 class="signature " id="update-instance_method">
1026
+
1027
+ #<strong>update</strong>(identifier:, updated_attrs:) &#x21d2; <tt>Object</tt>
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+ </h3><div class="docstring">
1034
+ <div class="discussion">
1035
+
1036
+ <p>Update a record in the DAO corresponding to the specified identifier, using
1037
+ the specified attribute-name/value pairs.</p>
1038
+
1039
+
1040
+ </div>
1041
+ </div>
1042
+ <div class="tags">
1043
+
1044
+ <div class="examples">
1045
+ <p class="tag_title">Examples:</p>
1046
+
1047
+
1048
+ <pre class="example code"><code><span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_user_repo'>user_repo</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span> <span class='ivar'>@user</span><span class='period'>.</span><span class='id identifier rubyid_slug'>slug</span><span class='comma'>,</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='symbol'>:user_params</span><span class='rbracket'>]</span>
1049
+ <span class='ivar'>@user</span> <span class='op'>=</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_entity'>entity</span> <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_success?'>success?</span></code></pre>
1050
+
1051
+ </div>
1052
+ <p class="tag_title">Parameters:</p>
1053
+ <ul class="param">
1054
+
1055
+ <li>
1056
+
1057
+ <span class='name'>identifier</span>
1058
+
1059
+
1060
+ <span class='type'>(<tt>String</tt>)</span>
1061
+
1062
+
1063
+
1064
+ &mdash;
1065
+ <div class='inline'>
1066
+ <p>[Slug](<a
1067
+ href="http://en.wikipedia.org/wiki/Semantic_URL#Slug">en.wikipedia.org/wiki/Semantic_URL#Slug</a>)
1068
+ for record to be deleted.</p>
1069
+ </div>
1070
+
1071
+ </li>
1072
+
1073
+ <li>
1074
+
1075
+ <span class='name'>updated_attrs</span>
1076
+
1077
+
1078
+ <span class='type'>(<tt>Hash</tt>)</span>
1079
+
1080
+
1081
+
1082
+ &mdash;
1083
+ <div class='inline'>
1084
+ <p>Attributes to be updated.</p>
1085
+ </div>
1086
+
1087
+ </li>
1088
+
1089
+ </ul>
1090
+
1091
+ <p class="tag_title">Since:</p>
1092
+ <ul class="since">
1093
+
1094
+ <li>
1095
+
1096
+
1097
+
1098
+
1099
+
1100
+ <div class='inline'>
1101
+ <p>0.0.4</p>
1102
+ </div>
1103
+
1104
+ </li>
1105
+
1106
+ </ul>
1107
+
1108
+ </div><table class="source_code">
1109
+ <tr>
1110
+ <td>
1111
+ <pre class="lines">
1112
+
1113
+
1114
+ 90
1115
+ 91
1116
+ 92
1117
+ 93</pre>
1118
+ </td>
1119
+ <td>
1120
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 90</span>
1121
+
1122
+ <span class='kw'>def</span> <span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='label'>identifier:</span><span class='comma'>,</span> <span class='label'>updated_attrs:</span><span class='rparen'>)</span>
1123
+ <span class='const'><span class='object_link'><a href="Base/Internals/RecordUpdater.html" title="Repository::Base::Internals::RecordUpdater (class)">RecordUpdater</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Base/Internals/RecordUpdater.html#initialize-instance_method" title="Repository::Base::Internals::RecordUpdater#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>identifier:</span> <span class='id identifier rubyid_identifier'>identifier</span><span class='comma'>,</span> <span class='label'>updated_attrs:</span> <span class='id identifier rubyid_updated_attrs'>updated_attrs</span><span class='comma'>,</span>
1124
+ <span class='label'>dao:</span> <span class='id identifier rubyid_dao'>dao</span><span class='comma'>,</span> <span class='label'>factory:</span> <span class='id identifier rubyid_factory'>factory</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_update'><span class='object_link'><a href="Base/Internals/RecordUpdater.html#update-instance_method" title="Repository::Base::Internals::RecordUpdater#update (method)">update</a></span></span>
1125
+ <span class='kw'>end</span></pre>
1126
+ </td>
1127
+ </tr>
1128
+ </table>
1129
+ </div>
1130
+
1131
+ <div class="method_details ">
1132
+ <h3 class="signature " id="validate_initializer_argument-instance_method">
1133
+
1134
+ #<strong>validate_initializer_argument</strong>(arg_sym, value) &#x21d2; <tt>boolean</tt> <span class="extras">(private)</span>
1135
+
1136
+
1137
+
1138
+
1139
+
1140
+ </h3><div class="docstring">
1141
+ <div class="discussion">
1142
+
1143
+ <p>Verifies that parameter passed to #initialize is a Class.</p>
1144
+
1145
+
1146
+ </div>
1147
+ </div>
1148
+ <div class="tags">
1149
+ <p class="tag_title">Parameters:</p>
1150
+ <ul class="param">
1151
+
1152
+ <li>
1153
+
1154
+ <span class='name'>arg_sym</span>
1155
+
1156
+
1157
+ <span class='type'>(<tt>Symbol</tt>)</span>
1158
+
1159
+
1160
+
1161
+ &mdash;
1162
+ <div class='inline'>
1163
+ <p>Which parameter is being validated, either `:dao` or `:factory`.</p>
1164
+ </div>
1165
+
1166
+ </li>
1167
+
1168
+ <li>
1169
+
1170
+ <span class='name'>value</span>
1171
+
1172
+
1173
+ <span class='type'></span>
1174
+
1175
+
1176
+
1177
+ &mdash;
1178
+ <div class='inline'>
1179
+ <p>Parameter value being validated. Must be a Class.</p>
1180
+ </div>
1181
+
1182
+ </li>
1183
+
1184
+ </ul>
1185
+
1186
+ <p class="tag_title">Returns:</p>
1187
+ <ul class="return">
1188
+
1189
+ <li>
1190
+
1191
+
1192
+ <span class='type'>(<tt>boolean</tt>)</span>
1193
+
1194
+
1195
+
1196
+ </li>
1197
+
1198
+ </ul>
1199
+ <p class="tag_title">Raises:</p>
1200
+ <ul class="raise">
1201
+
1202
+ <li>
1203
+
1204
+
1205
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
1206
+
1207
+
1208
+
1209
+ </li>
1210
+
1211
+ </ul>
1212
+
1213
+ </div><table class="source_code">
1214
+ <tr>
1215
+ <td>
1216
+ <pre class="lines">
1217
+
1218
+
1219
+ 104
1220
+ 105
1221
+ 106
1222
+ 107</pre>
1223
+ </td>
1224
+ <td>
1225
+ <pre class="code"><span class="info file"># File 'lib/repository/base.rb', line 104</span>
1226
+
1227
+ <span class='kw'>def</span> <span class='id identifier rubyid_validate_initializer_argument'>validate_initializer_argument</span><span class='lparen'>(</span><span class='id identifier rubyid_arg_sym'>arg_sym</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
1228
+ <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>the :</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_arg_sym'>arg_sym</span><span class='embexpr_end'>}</span><span class='tstring_content'> argument must be a Class</span><span class='tstring_end'>&quot;</span></span>
1229
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span> <span class='kw'>unless</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span> <span class='symbol'>:new</span>
1230
+ <span class='kw'>end</span></pre>
1231
+ </td>
1232
+ </tr>
1233
+ </table>
1234
+ </div>
1235
+
1236
+ </div>
1237
+
1238
+ </div>
1239
+
1240
+ <div id="footer">
1241
+ Generated on Sat Feb 3 03:00:18 2018 by
1242
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1243
+ 0.9.12 (ruby-2.5.0).
1244
+ </div>
1245
+
1246
+ </div>
1247
+ </body>
1248
+ </html>