repository-base 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.rubocop.yml +27 -0
- data/.travis.yml +6 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +128 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +132 -0
- data/Rakefile +33 -0
- data/bin/bundle +105 -0
- data/bin/htmldiff +29 -0
- data/bin/kramdown +29 -0
- data/bin/ldiff +29 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/rubocop +29 -0
- data/bin/ruby-parse +29 -0
- data/bin/ruby-rewrite +29 -0
- data/bin/setup +43 -0
- data/bin/yard +29 -0
- data/bin/yardoc +29 -0
- data/bin/yri +29 -0
- data/doc/Repository.html +128 -0
- data/doc/Repository/Base.html +1248 -0
- data/doc/Repository/Base/Internals.html +133 -0
- data/doc/Repository/Base/Internals/RecordDeleter.html +687 -0
- data/doc/Repository/Base/Internals/RecordSaver.html +816 -0
- data/doc/Repository/Base/Internals/RecordUpdater.html +1026 -0
- data/doc/Repository/Base/Internals/SlugFinder.html +986 -0
- data/doc/_index.html +176 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +499 -0
- data/doc/file.CHANGELOG.html +240 -0
- data/doc/file.README.html +218 -0
- data/doc/file_list.html +61 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +218 -0
- data/doc/js/app.js +248 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +363 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/repository/base.rb +115 -0
- data/lib/repository/base/internals/internals.rb +6 -0
- data/lib/repository/base/internals/record_deleter.rb +46 -0
- data/lib/repository/base/internals/record_saver.rb +58 -0
- data/lib/repository/base/internals/record_updater.rb +54 -0
- data/lib/repository/base/internals/slug_finder.rb +70 -0
- data/lib/repository/base/version.rb +12 -0
- data/repository-base.gemspec +37 -0
- data/spec/repository/base_spec.rb +398 -0
- data/spec/spec_helper.rb +14 -0
- metadata +281 -0
@@ -0,0 +1,986 @@
|
|
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::Internals::SlugFinder
|
8
|
+
|
9
|
+
— 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::Internals::SlugFinder";
|
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 (S)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../../Repository.html" title="Repository (module)">Repository</a></span></span> » <span class='title'><span class='object_link'><a href="../../Base.html" title="Repository::Base (class)">Base</a></span></span> » <span class='title'><span class='object_link'><a href="../Internals.html" title="Repository::Base::Internals (module)">Internals</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">SlugFinder</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::Internals::SlugFinder
|
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::Internals::SlugFinder</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>Support</dd>
|
93
|
+
</dl>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dl>
|
101
|
+
<dt>Defined in:</dt>
|
102
|
+
<dd>lib/repository/base/internals/slug_finder.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
108
|
+
<div class="discussion">
|
109
|
+
|
110
|
+
<p>Find a slug in the DAO, reporting errors if not successful.</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
<p class="tag_title">Since:</p>
|
118
|
+
<ul class="since">
|
119
|
+
|
120
|
+
<li>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<div class='inline'>
|
127
|
+
<p>0.0.3</p>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</li>
|
131
|
+
|
132
|
+
</ul>
|
133
|
+
|
134
|
+
</div>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
139
|
+
<ul class="summary">
|
140
|
+
|
141
|
+
<li class="private ">
|
142
|
+
<span class="summary_signature">
|
143
|
+
|
144
|
+
<a href="#dao-instance_method" title="#dao (instance method)">#<strong>dao</strong> ⇒ Object </a>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</span>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<span class="note title readonly">readonly</span>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<span class="note title private">private</span>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
164
|
+
|
165
|
+
</li>
|
166
|
+
|
167
|
+
|
168
|
+
<li class="private ">
|
169
|
+
<span class="summary_signature">
|
170
|
+
|
171
|
+
<a href="#factory-instance_method" title="#factory (instance method)">#<strong>factory</strong> ⇒ Object </a>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
</span>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
<span class="note title readonly">readonly</span>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<span class="note title private">private</span>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li class="private ">
|
196
|
+
<span class="summary_signature">
|
197
|
+
|
198
|
+
<a href="#slug-instance_method" title="#slug (instance method)">#<strong>slug</strong> ⇒ Object </a>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</span>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<span class="note title readonly">readonly</span>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<span class="note title private">private</span>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
218
|
+
|
219
|
+
</li>
|
220
|
+
|
221
|
+
|
222
|
+
</ul>
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
<h2>
|
229
|
+
Instance Method Summary
|
230
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
231
|
+
</h2>
|
232
|
+
|
233
|
+
<ul class="summary">
|
234
|
+
|
235
|
+
<li class="private ">
|
236
|
+
<span class="summary_signature">
|
237
|
+
|
238
|
+
<a href="#entity_for_slug-instance_method" title="#entity_for_slug (instance method)">#<strong>entity_for_slug</strong> ⇒ Object </a>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
</span>
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
<span class="note title private">private</span>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
<span class="summary_desc"><div class='inline'>
|
253
|
+
<p>Builds an entity from an existing DAO record matching the slug.</p>
|
254
|
+
</div></span>
|
255
|
+
|
256
|
+
</li>
|
257
|
+
|
258
|
+
|
259
|
+
<li class="private ">
|
260
|
+
<span class="summary_signature">
|
261
|
+
|
262
|
+
<a href="#errors_for_slug-instance_method" title="#errors_for_slug (instance method)">#<strong>errors_for_slug</strong> ⇒ ActiveModel::Errors </a>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
</span>
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
<span class="note title private">private</span>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
<span class="summary_desc"><div class='inline'>
|
277
|
+
<p>Builds an [`ActiveModel::Errors`](<a
|
278
|
+
href="http://api.rubyonrails.org/classes/ActiveModel/Errors.html">api.rubyonrails.org/classes/ActiveModel/Errors.html</a>)
|
279
|
+
instance and adds a slug-not-found message to it.</p>
|
280
|
+
</div></span>
|
281
|
+
|
282
|
+
</li>
|
283
|
+
|
284
|
+
|
285
|
+
<li class="public ">
|
286
|
+
<span class="summary_signature">
|
287
|
+
|
288
|
+
<a href="#find-instance_method" title="#find (instance method)">#<strong>find</strong> ⇒ Repository::Support::StoreResult </a>
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
</span>
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
<span class="summary_desc"><div class='inline'>
|
303
|
+
<p>Command-pattern method to search underlying DAO for record matching slug.</p>
|
304
|
+
</div></span>
|
305
|
+
|
306
|
+
</li>
|
307
|
+
|
308
|
+
|
309
|
+
<li class="public ">
|
310
|
+
<span class="summary_signature">
|
311
|
+
|
312
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(slug:, dao:, factory:) ⇒ SlugFinder </a>
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
</span>
|
317
|
+
|
318
|
+
|
319
|
+
<span class="note title constructor">constructor</span>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
<span class="summary_desc"><div class='inline'>
|
329
|
+
<p>Initializes a new instance of `SlugFinder`.</p>
|
330
|
+
</div></span>
|
331
|
+
|
332
|
+
</li>
|
333
|
+
|
334
|
+
|
335
|
+
<li class="private ">
|
336
|
+
<span class="summary_signature">
|
337
|
+
|
338
|
+
<a href="#result_builder-instance_method" title="#result_builder (instance method)">#<strong>result_builder</strong>(record) ⇒ Object </a>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
</span>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
<span class="note title private">private</span>
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<span class="summary_desc"><div class='inline'>
|
353
|
+
<p>Returns a new `Repository::Support::ResultBuilder` instance, passing the
|
354
|
+
parameter specified to this method as its `#initialize` parameter.</p>
|
355
|
+
</div></span>
|
356
|
+
|
357
|
+
</li>
|
358
|
+
|
359
|
+
|
360
|
+
</ul>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
<div id="constructor_details" class="method_details_list">
|
365
|
+
<h2>Constructor Details</h2>
|
366
|
+
|
367
|
+
<div class="method_details first">
|
368
|
+
<h3 class="signature first" id="initialize-instance_method">
|
369
|
+
|
370
|
+
#<strong>initialize</strong>(slug:, dao:, factory:) ⇒ <tt><span class='object_link'><a href="" title="Repository::Base::Internals::SlugFinder (class)">SlugFinder</a></span></tt>
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
</h3><div class="docstring">
|
377
|
+
<div class="discussion">
|
378
|
+
|
379
|
+
<p>Initializes a new instance of `SlugFinder`.</p>
|
380
|
+
|
381
|
+
|
382
|
+
</div>
|
383
|
+
</div>
|
384
|
+
<div class="tags">
|
385
|
+
<p class="tag_title">Parameters:</p>
|
386
|
+
<ul class="param">
|
387
|
+
|
388
|
+
<li>
|
389
|
+
|
390
|
+
<span class='name'>slug</span>
|
391
|
+
|
392
|
+
|
393
|
+
<span class='type'>(<tt>String</tt>)</span>
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
—
|
398
|
+
<div class='inline'>
|
399
|
+
<p>[Slug](<a
|
400
|
+
href="http://en.wikipedia.org/wiki/Semantic_URL#Slug">en.wikipedia.org/wiki/Semantic_URL#Slug</a>)
|
401
|
+
for record to be deleted.</p>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
</li>
|
405
|
+
|
406
|
+
<li>
|
407
|
+
|
408
|
+
<span class='name'>dao</span>
|
409
|
+
|
410
|
+
|
411
|
+
<span class='type'></span>
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
—
|
416
|
+
<div class='inline'>
|
417
|
+
<p>Data Access Object implements persistence without business logic.</p>
|
418
|
+
</div>
|
419
|
+
|
420
|
+
</li>
|
421
|
+
|
422
|
+
</ul>
|
423
|
+
|
424
|
+
<p class="tag_title">Since:</p>
|
425
|
+
<ul class="since">
|
426
|
+
|
427
|
+
<li>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
<div class='inline'>
|
434
|
+
<p>0.0.3</p>
|
435
|
+
</div>
|
436
|
+
|
437
|
+
</li>
|
438
|
+
|
439
|
+
</ul>
|
440
|
+
|
441
|
+
</div><table class="source_code">
|
442
|
+
<tr>
|
443
|
+
<td>
|
444
|
+
<pre class="lines">
|
445
|
+
|
446
|
+
|
447
|
+
20
|
448
|
+
21
|
449
|
+
22
|
450
|
+
23
|
451
|
+
24</pre>
|
452
|
+
</td>
|
453
|
+
<td>
|
454
|
+
<pre class="code"><span class="info file"># File 'lib/repository/base/internals/slug_finder.rb', line 20</span>
|
455
|
+
|
456
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>slug:</span><span class='comma'>,</span> <span class='label'>dao:</span><span class='comma'>,</span> <span class='label'>factory:</span><span class='rparen'>)</span>
|
457
|
+
<span class='ivar'>@slug</span> <span class='op'>=</span> <span class='id identifier rubyid_slug'>slug</span>
|
458
|
+
<span class='ivar'>@dao</span> <span class='op'>=</span> <span class='id identifier rubyid_dao'>dao</span>
|
459
|
+
<span class='ivar'>@factory</span> <span class='op'>=</span> <span class='id identifier rubyid_factory'>factory</span>
|
460
|
+
<span class='kw'>end</span></pre>
|
461
|
+
</td>
|
462
|
+
</tr>
|
463
|
+
</table>
|
464
|
+
</div>
|
465
|
+
|
466
|
+
</div>
|
467
|
+
|
468
|
+
<div id="instance_attr_details" class="attr_details">
|
469
|
+
<h2>Instance Attribute Details</h2>
|
470
|
+
|
471
|
+
|
472
|
+
<span id=""></span>
|
473
|
+
<div class="method_details first">
|
474
|
+
<h3 class="signature first" id="dao-instance_method">
|
475
|
+
|
476
|
+
#<strong>dao</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly, private)</span>
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
</h3><div class="docstring">
|
483
|
+
<div class="discussion">
|
484
|
+
|
485
|
+
|
486
|
+
</div>
|
487
|
+
</div>
|
488
|
+
<div class="tags">
|
489
|
+
|
490
|
+
<p class="tag_title">Since:</p>
|
491
|
+
<ul class="since">
|
492
|
+
|
493
|
+
<li>
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
<div class='inline'>
|
500
|
+
<p>0.0.3</p>
|
501
|
+
</div>
|
502
|
+
|
503
|
+
</li>
|
504
|
+
|
505
|
+
</ul>
|
506
|
+
|
507
|
+
</div><table class="source_code">
|
508
|
+
<tr>
|
509
|
+
<td>
|
510
|
+
<pre class="lines">
|
511
|
+
|
512
|
+
|
513
|
+
41
|
514
|
+
42
|
515
|
+
43</pre>
|
516
|
+
</td>
|
517
|
+
<td>
|
518
|
+
<pre class="code"><span class="info file"># File 'lib/repository/base/internals/slug_finder.rb', line 41</span>
|
519
|
+
|
520
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dao'>dao</span>
|
521
|
+
<span class='ivar'>@dao</span>
|
522
|
+
<span class='kw'>end</span></pre>
|
523
|
+
</td>
|
524
|
+
</tr>
|
525
|
+
</table>
|
526
|
+
</div>
|
527
|
+
|
528
|
+
|
529
|
+
<span id=""></span>
|
530
|
+
<div class="method_details ">
|
531
|
+
<h3 class="signature " id="factory-instance_method">
|
532
|
+
|
533
|
+
#<strong>factory</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly, private)</span>
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
</h3><div class="docstring">
|
540
|
+
<div class="discussion">
|
541
|
+
|
542
|
+
|
543
|
+
</div>
|
544
|
+
</div>
|
545
|
+
<div class="tags">
|
546
|
+
|
547
|
+
<p class="tag_title">Since:</p>
|
548
|
+
<ul class="since">
|
549
|
+
|
550
|
+
<li>
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
<div class='inline'>
|
557
|
+
<p>0.0.3</p>
|
558
|
+
</div>
|
559
|
+
|
560
|
+
</li>
|
561
|
+
|
562
|
+
</ul>
|
563
|
+
|
564
|
+
</div><table class="source_code">
|
565
|
+
<tr>
|
566
|
+
<td>
|
567
|
+
<pre class="lines">
|
568
|
+
|
569
|
+
|
570
|
+
41
|
571
|
+
42
|
572
|
+
43</pre>
|
573
|
+
</td>
|
574
|
+
<td>
|
575
|
+
<pre class="code"><span class="info file"># File 'lib/repository/base/internals/slug_finder.rb', line 41</span>
|
576
|
+
|
577
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_factory'>factory</span>
|
578
|
+
<span class='ivar'>@factory</span>
|
579
|
+
<span class='kw'>end</span></pre>
|
580
|
+
</td>
|
581
|
+
</tr>
|
582
|
+
</table>
|
583
|
+
</div>
|
584
|
+
|
585
|
+
|
586
|
+
<span id=""></span>
|
587
|
+
<div class="method_details ">
|
588
|
+
<h3 class="signature " id="slug-instance_method">
|
589
|
+
|
590
|
+
#<strong>slug</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly, private)</span>
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
|
596
|
+
</h3><div class="docstring">
|
597
|
+
<div class="discussion">
|
598
|
+
|
599
|
+
|
600
|
+
</div>
|
601
|
+
</div>
|
602
|
+
<div class="tags">
|
603
|
+
|
604
|
+
<p class="tag_title">Since:</p>
|
605
|
+
<ul class="since">
|
606
|
+
|
607
|
+
<li>
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
<div class='inline'>
|
614
|
+
<p>0.0.3</p>
|
615
|
+
</div>
|
616
|
+
|
617
|
+
</li>
|
618
|
+
|
619
|
+
</ul>
|
620
|
+
|
621
|
+
</div><table class="source_code">
|
622
|
+
<tr>
|
623
|
+
<td>
|
624
|
+
<pre class="lines">
|
625
|
+
|
626
|
+
|
627
|
+
41
|
628
|
+
42
|
629
|
+
43</pre>
|
630
|
+
</td>
|
631
|
+
<td>
|
632
|
+
<pre class="code"><span class="info file"># File 'lib/repository/base/internals/slug_finder.rb', line 41</span>
|
633
|
+
|
634
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_slug'>slug</span>
|
635
|
+
<span class='ivar'>@slug</span>
|
636
|
+
<span class='kw'>end</span></pre>
|
637
|
+
</td>
|
638
|
+
</tr>
|
639
|
+
</table>
|
640
|
+
</div>
|
641
|
+
|
642
|
+
</div>
|
643
|
+
|
644
|
+
|
645
|
+
<div id="instance_method_details" class="method_details_list">
|
646
|
+
<h2>Instance Method Details</h2>
|
647
|
+
|
648
|
+
|
649
|
+
<div class="method_details first">
|
650
|
+
<h3 class="signature first" id="entity_for_slug-instance_method">
|
651
|
+
|
652
|
+
#<strong>entity_for_slug</strong> ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
</h3><div class="docstring">
|
659
|
+
<div class="discussion">
|
660
|
+
|
661
|
+
<p>Builds an entity from an existing DAO record matching the slug.</p>
|
662
|
+
|
663
|
+
|
664
|
+
</div>
|
665
|
+
</div>
|
666
|
+
<div class="tags">
|
667
|
+
|
668
|
+
<p class="tag_title">Returns:</p>
|
669
|
+
<ul class="return">
|
670
|
+
|
671
|
+
<li>
|
672
|
+
|
673
|
+
|
674
|
+
<span class='type'></span>
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
<div class='inline'>
|
680
|
+
<p>If the slug matches an existing DAO record, returns an entity as built from
|
681
|
+
that record, otherwise returns `nil`.</p>
|
682
|
+
</div>
|
683
|
+
|
684
|
+
</li>
|
685
|
+
|
686
|
+
</ul>
|
687
|
+
<p class="tag_title">Since:</p>
|
688
|
+
<ul class="since">
|
689
|
+
|
690
|
+
<li>
|
691
|
+
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
<div class='inline'>
|
697
|
+
<p>0.0.3</p>
|
698
|
+
</div>
|
699
|
+
|
700
|
+
</li>
|
701
|
+
|
702
|
+
</ul>
|
703
|
+
|
704
|
+
</div><table class="source_code">
|
705
|
+
<tr>
|
706
|
+
<td>
|
707
|
+
<pre class="lines">
|
708
|
+
|
709
|
+
|
710
|
+
46
|
711
|
+
47
|
712
|
+
48
|
713
|
+
49</pre>
|
714
|
+
</td>
|
715
|
+
<td>
|
716
|
+
<pre class="code"><span class="info file"># File 'lib/repository/base/internals/slug_finder.rb', line 46</span>
|
717
|
+
|
718
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_entity_for_slug'>entity_for_slug</span>
|
719
|
+
<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_where'>where</span><span class='lparen'>(</span><span class='label'>slug:</span> <span class='id identifier rubyid_slug'>slug</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
720
|
+
<span class='id identifier rubyid_factory'>factory</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_record'>record</span>
|
721
|
+
<span class='kw'>end</span></pre>
|
722
|
+
</td>
|
723
|
+
</tr>
|
724
|
+
</table>
|
725
|
+
</div>
|
726
|
+
|
727
|
+
<div class="method_details ">
|
728
|
+
<h3 class="signature " id="errors_for_slug-instance_method">
|
729
|
+
|
730
|
+
#<strong>errors_for_slug</strong> ⇒ <tt>ActiveModel::Errors</tt> <span class="extras">(private)</span>
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
|
735
|
+
|
736
|
+
</h3><div class="docstring">
|
737
|
+
<div class="discussion">
|
738
|
+
|
739
|
+
<p>Builds an [`ActiveModel::Errors`](<a
|
740
|
+
href="http://api.rubyonrails.org/classes/ActiveModel/Errors.html">api.rubyonrails.org/classes/ActiveModel/Errors.html</a>)
|
741
|
+
instance and adds a slug-not-found message to it.</p>
|
742
|
+
|
743
|
+
|
744
|
+
</div>
|
745
|
+
</div>
|
746
|
+
<div class="tags">
|
747
|
+
|
748
|
+
<p class="tag_title">Returns:</p>
|
749
|
+
<ul class="return">
|
750
|
+
|
751
|
+
<li>
|
752
|
+
|
753
|
+
|
754
|
+
<span class='type'>(<tt>ActiveModel::Errors</tt>)</span>
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
</li>
|
759
|
+
|
760
|
+
</ul>
|
761
|
+
|
762
|
+
<p class="tag_title">See Also:</p>
|
763
|
+
<ul class="see">
|
764
|
+
|
765
|
+
<li><span class='object_link'><a href="#find-instance_method" title="Repository::Base::Internals::SlugFinder#find (method)">#find</a></span></li>
|
766
|
+
|
767
|
+
</ul>
|
768
|
+
<p class="tag_title">Since:</p>
|
769
|
+
<ul class="since">
|
770
|
+
|
771
|
+
<li>
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
<div class='inline'>
|
778
|
+
<p>0.0.3</p>
|
779
|
+
</div>
|
780
|
+
|
781
|
+
</li>
|
782
|
+
|
783
|
+
</ul>
|
784
|
+
|
785
|
+
</div><table class="source_code">
|
786
|
+
<tr>
|
787
|
+
<td>
|
788
|
+
<pre class="lines">
|
789
|
+
|
790
|
+
|
791
|
+
55
|
792
|
+
56
|
793
|
+
57
|
794
|
+
58
|
795
|
+
59</pre>
|
796
|
+
</td>
|
797
|
+
<td>
|
798
|
+
<pre class="code"><span class="info file"># File 'lib/repository/base/internals/slug_finder.rb', line 55</span>
|
799
|
+
|
800
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_errors_for_slug'>errors_for_slug</span>
|
801
|
+
<span class='id identifier rubyid_errors'>errors</span> <span class='op'>=</span> <span class='const'>ActiveModel</span><span class='op'>::</span><span class='const'>Errors</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_dao'>dao</span>
|
802
|
+
<span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span> <span class='symbol'>:slug</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>not found: '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_slug'>slug</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
803
|
+
<span class='id identifier rubyid_errors'>errors</span>
|
804
|
+
<span class='kw'>end</span></pre>
|
805
|
+
</td>
|
806
|
+
</tr>
|
807
|
+
</table>
|
808
|
+
</div>
|
809
|
+
|
810
|
+
<div class="method_details ">
|
811
|
+
<h3 class="signature " id="find-instance_method">
|
812
|
+
|
813
|
+
#<strong>find</strong> ⇒ <tt>Repository::Support::StoreResult</tt>
|
814
|
+
|
815
|
+
|
816
|
+
|
817
|
+
|
818
|
+
|
819
|
+
</h3><div class="docstring">
|
820
|
+
<div class="discussion">
|
821
|
+
|
822
|
+
<p>Command-pattern method to search underlying DAO for record matching slug.
|
823
|
+
Returns a `Repository::Support::StoreResult` instance with the
|
824
|
+
corresponding entity on success, or with the error hash built by
|
825
|
+
`Repository::Support::ErrorFactory.create` on failure.</p>
|
826
|
+
|
827
|
+
|
828
|
+
</div>
|
829
|
+
</div>
|
830
|
+
<div class="tags">
|
831
|
+
|
832
|
+
<p class="tag_title">Returns:</p>
|
833
|
+
<ul class="return">
|
834
|
+
|
835
|
+
<li>
|
836
|
+
|
837
|
+
|
838
|
+
<span class='type'>(<tt>Repository::Support::StoreResult</tt>)</span>
|
839
|
+
|
840
|
+
|
841
|
+
|
842
|
+
</li>
|
843
|
+
|
844
|
+
</ul>
|
845
|
+
|
846
|
+
<p class="tag_title">See Also:</p>
|
847
|
+
<ul class="see">
|
848
|
+
|
849
|
+
<li><span class='object_link'><a href="#errors_for_slug-instance_method" title="Repository::Base::Internals::SlugFinder#errors_for_slug (method)">#errors_for_slug</a></span></li>
|
850
|
+
|
851
|
+
<li><span class='object_link'><a href="#result_builder-instance_method" title="Repository::Base::Internals::SlugFinder#result_builder (method)">#result_builder</a></span></li>
|
852
|
+
|
853
|
+
</ul>
|
854
|
+
<p class="tag_title">Since:</p>
|
855
|
+
<ul class="since">
|
856
|
+
|
857
|
+
<li>
|
858
|
+
|
859
|
+
|
860
|
+
|
861
|
+
|
862
|
+
|
863
|
+
<div class='inline'>
|
864
|
+
<p>0.0.3</p>
|
865
|
+
</div>
|
866
|
+
|
867
|
+
</li>
|
868
|
+
|
869
|
+
</ul>
|
870
|
+
|
871
|
+
</div><table class="source_code">
|
872
|
+
<tr>
|
873
|
+
<td>
|
874
|
+
<pre class="lines">
|
875
|
+
|
876
|
+
|
877
|
+
33
|
878
|
+
34
|
879
|
+
35
|
880
|
+
36
|
881
|
+
37</pre>
|
882
|
+
</td>
|
883
|
+
<td>
|
884
|
+
<pre class="code"><span class="info file"># File 'lib/repository/base/internals/slug_finder.rb', line 33</span>
|
885
|
+
|
886
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find'>find</span>
|
887
|
+
<span class='id identifier rubyid_result_builder'>result_builder</span><span class='lparen'>(</span><span class='id identifier rubyid_entity_for_slug'>entity_for_slug</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_build'>build</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid__failed_record'>_failed_record</span><span class='op'>|</span>
|
888
|
+
<span class='const'>ErrorFactory</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span> <span class='id identifier rubyid_errors_for_slug'>errors_for_slug</span>
|
889
|
+
<span class='kw'>end</span>
|
890
|
+
<span class='kw'>end</span></pre>
|
891
|
+
</td>
|
892
|
+
</tr>
|
893
|
+
</table>
|
894
|
+
</div>
|
895
|
+
|
896
|
+
<div class="method_details ">
|
897
|
+
<h3 class="signature " id="result_builder-instance_method">
|
898
|
+
|
899
|
+
#<strong>result_builder</strong>(record) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
900
|
+
|
901
|
+
|
902
|
+
|
903
|
+
|
904
|
+
|
905
|
+
</h3><div class="docstring">
|
906
|
+
<div class="discussion">
|
907
|
+
|
908
|
+
<p>Returns a new `Repository::Support::ResultBuilder` instance, passing the
|
909
|
+
parameter specified to this method as its `#initialize` parameter.</p>
|
910
|
+
|
911
|
+
|
912
|
+
</div>
|
913
|
+
</div>
|
914
|
+
<div class="tags">
|
915
|
+
<p class="tag_title">Parameters:</p>
|
916
|
+
<ul class="param">
|
917
|
+
|
918
|
+
<li>
|
919
|
+
|
920
|
+
<span class='name'>record</span>
|
921
|
+
|
922
|
+
|
923
|
+
<span class='type'></span>
|
924
|
+
|
925
|
+
|
926
|
+
|
927
|
+
—
|
928
|
+
<div class='inline'>
|
929
|
+
<p>DAO record to pass to `ResultBuilder#initialize`.</p>
|
930
|
+
</div>
|
931
|
+
|
932
|
+
</li>
|
933
|
+
|
934
|
+
</ul>
|
935
|
+
|
936
|
+
<p class="tag_title">Since:</p>
|
937
|
+
<ul class="since">
|
938
|
+
|
939
|
+
<li>
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
|
945
|
+
<div class='inline'>
|
946
|
+
<p>0.0.3</p>
|
947
|
+
</div>
|
948
|
+
|
949
|
+
</li>
|
950
|
+
|
951
|
+
</ul>
|
952
|
+
|
953
|
+
</div><table class="source_code">
|
954
|
+
<tr>
|
955
|
+
<td>
|
956
|
+
<pre class="lines">
|
957
|
+
|
958
|
+
|
959
|
+
64
|
960
|
+
65
|
961
|
+
66</pre>
|
962
|
+
</td>
|
963
|
+
<td>
|
964
|
+
<pre class="code"><span class="info file"># File 'lib/repository/base/internals/slug_finder.rb', line 64</span>
|
965
|
+
|
966
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_result_builder'>result_builder</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='rparen'>)</span>
|
967
|
+
<span class='const'>ResultBuilder</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_record'>record</span>
|
968
|
+
<span class='kw'>end</span></pre>
|
969
|
+
</td>
|
970
|
+
</tr>
|
971
|
+
</table>
|
972
|
+
</div>
|
973
|
+
|
974
|
+
</div>
|
975
|
+
|
976
|
+
</div>
|
977
|
+
|
978
|
+
<div id="footer">
|
979
|
+
Generated on Sat Feb 3 03:00:18 2018 by
|
980
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
981
|
+
0.9.12 (ruby-2.5.0).
|
982
|
+
</div>
|
983
|
+
|
984
|
+
</div>
|
985
|
+
</body>
|
986
|
+
</html>
|