ae_easy-test 0.0.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 (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +7 -0
  4. data/.yardopts +1 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +65 -0
  8. data/LICENSE +21 -0
  9. data/README.md +16 -0
  10. data/Rakefile +22 -0
  11. data/ae_easy-test.gemspec +49 -0
  12. data/doc/AeEasy.html +117 -0
  13. data/doc/AeEasy/Core.html +117 -0
  14. data/doc/AeEasy/Core/Mock.html +115 -0
  15. data/doc/AeEasy/Core/Mock/FakeExecutor.html +2037 -0
  16. data/doc/AeEasy/Core/Modk.html +105 -0
  17. data/doc/AeEasy/Core/Plugin.html +117 -0
  18. data/doc/AeEasy/Core/Plugin/ExecutorBehavior.html +196 -0
  19. data/doc/AeEasy/Test.html +616 -0
  20. data/doc/AeEasy/Test/Helper.html +1721 -0
  21. data/doc/AeEasy/Test/RecordTask.html +2493 -0
  22. data/doc/_index.html +237 -0
  23. data/doc/class_list.html +51 -0
  24. data/doc/css/common.css +1 -0
  25. data/doc/css/full_list.css +58 -0
  26. data/doc/css/style.css +496 -0
  27. data/doc/file.README.html +91 -0
  28. data/doc/file_list.html +56 -0
  29. data/doc/frames.html +17 -0
  30. data/doc/index.html +91 -0
  31. data/doc/js/app.js +292 -0
  32. data/doc/js/full_list.js +216 -0
  33. data/doc/js/jquery.js +4 -0
  34. data/doc/method_list.html +419 -0
  35. data/doc/top-level-namespace.html +110 -0
  36. data/lib/ae_easy/test.rb +52 -0
  37. data/lib/ae_easy/test/helper.rb +224 -0
  38. data/lib/ae_easy/test/rake.rb +335 -0
  39. data/lib/ae_easy/test/version.rb +6 -0
  40. data/lib/ae_easy_override/core.rb +7 -0
  41. data/lib/ae_easy_override/core/mock.rb +8 -0
  42. data/lib/ae_easy_override/core/mock/fake_executor.rb +324 -0
  43. data/lib/ae_easy_override/core/plugin.rb +8 -0
  44. data/lib/ae_easy_override/core/plugin/executor_behavior.rb +11 -0
  45. metadata +201 -0
@@ -0,0 +1,1721 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: AeEasy::Test::Helper
8
+
9
+ &mdash; Documentation by YARD 0.9.18
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 = "AeEasy::Test::Helper";
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 (H)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../AeEasy.html" title="AeEasy (module)">AeEasy</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Test.html" title="AeEasy::Test (module)">Test</a></span></span>
41
+ &raquo;
42
+ <span class="title">Helper</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>Module: AeEasy::Test::Helper
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/ae_easy/test/helper.rb</dd>
82
+ </dl>
83
+
84
+ </div>
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+ <h2>
95
+ Class Method Summary
96
+ <small><a href="#" class="summary_toggle">collapse</a></small>
97
+ </h2>
98
+
99
+ <ul class="summary">
100
+
101
+ <li class="public ">
102
+ <span class="summary_signature">
103
+
104
+ <a href="#collection_diff-class_method" title="collection_diff (class method)">.<strong>collection_diff</strong>(items_a, items_b, opts = {}) &#x21d2; Hash </a>
105
+
106
+
107
+
108
+ </span>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <span class="summary_desc"><div class='inline'>
119
+ <p>Generate a diff over 2 collections.</p>
120
+ </div></span>
121
+
122
+ </li>
123
+
124
+
125
+ <li class="public ">
126
+ <span class="summary_signature">
127
+
128
+ <a href="#collection_match%3F-class_method" title="collection_match? (class method)">.<strong>collection_match?</strong>(fragment, universe, opts = {}) &#x21d2; Boolean </a>
129
+
130
+
131
+
132
+ </span>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ <span class="summary_desc"><div class='inline'>
143
+ <p>Validate when an item collection match universe item collection.</p>
144
+ </div></span>
145
+
146
+ </li>
147
+
148
+
149
+ <li class="public ">
150
+ <span class="summary_signature">
151
+
152
+ <a href="#delete_keys_from!-class_method" title="delete_keys_from! (class method)">.<strong>delete_keys_from!</strong>(hash, keys) &#x21d2; Hash </a>
153
+
154
+
155
+
156
+ </span>
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+ <span class="summary_desc"><div class='inline'>
167
+ <p>Delete keys from a hash.</p>
168
+ </div></span>
169
+
170
+ </li>
171
+
172
+
173
+ <li class="public ">
174
+ <span class="summary_signature">
175
+
176
+ <a href="#load_file-class_method" title="load_file (class method)">.<strong>load_file</strong>(file_path, should_exists = false) &#x21d2; String<sup>?</sup> </a>
177
+
178
+
179
+
180
+ </span>
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+ <span class="summary_desc"><div class='inline'>
191
+ <p>Load and return file contents when exists.</p>
192
+ </div></span>
193
+
194
+ </li>
195
+
196
+
197
+ <li class="public ">
198
+ <span class="summary_signature">
199
+
200
+ <a href="#load_json_file-class_method" title="load_json_file (class method)">.<strong>load_json_file</strong>(file_path, should_exists = false) &#x21d2; Hash<sup>?</sup> </a>
201
+
202
+
203
+
204
+ </span>
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+ <span class="summary_desc"><div class='inline'>
215
+ <p>Load and return file contents as json when exists.</p>
216
+ </div></span>
217
+
218
+ </li>
219
+
220
+
221
+ <li class="public ">
222
+ <span class="summary_signature">
223
+
224
+ <a href="#match%3F-class_method" title="match? (class method)">.<strong>match?</strong>(element, filter, opts = {}) &#x21d2; Boolean </a>
225
+
226
+
227
+
228
+ </span>
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+ <span class="summary_desc"><div class='inline'>
239
+ <p>Check if an hash element match the filter.</p>
240
+ </div></span>
241
+
242
+ </li>
243
+
244
+
245
+ <li class="public ">
246
+ <span class="summary_signature">
247
+
248
+ <a href="#match_collections-class_method" title="match_collections (class method)">.<strong>match_collections</strong>(items_a, items_b, opts = {}) &#x21d2; Hash </a>
249
+
250
+
251
+
252
+ </span>
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+ <span class="summary_desc"><div class='inline'>
263
+ <p>Match two collections and calculate diff.</p>
264
+ </div></span>
265
+
266
+ </li>
267
+
268
+
269
+ <li class="public ">
270
+ <span class="summary_signature">
271
+
272
+ <a href="#sanitize-class_method" title="sanitize (class method)">.<strong>sanitize</strong>(raw_hash, opts) &#x21d2; Hash </a>
273
+
274
+
275
+
276
+ </span>
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+ <span class="summary_desc"><div class='inline'>
287
+ <p>Sanitize a copy of the hash provided.</p>
288
+ </div></span>
289
+
290
+ </li>
291
+
292
+
293
+ </ul>
294
+
295
+
296
+
297
+
298
+ <div id="class_method_details" class="method_details_list">
299
+ <h2>Class Method Details</h2>
300
+
301
+
302
+ <div class="method_details first">
303
+ <h3 class="signature first" id="collection_diff-class_method">
304
+
305
+ .<strong>collection_diff</strong>(items_a, items_b, opts = {}) &#x21d2; <tt>Hash</tt>
306
+
307
+
308
+
309
+
310
+
311
+ </h3><div class="docstring">
312
+ <div class="discussion">
313
+
314
+ <p>Generate a diff over 2 collections.</p>
315
+
316
+
317
+ </div>
318
+ </div>
319
+ <div class="tags">
320
+ <p class="tag_title">Parameters:</p>
321
+ <ul class="param">
322
+
323
+ <li>
324
+
325
+ <span class='name'>items_a</span>
326
+
327
+
328
+ <span class='type'>(<tt>Array</tt>)</span>
329
+
330
+
331
+
332
+ &mdash;
333
+ <div class='inline'>
334
+ <p>List of items to diff.</p>
335
+ </div>
336
+
337
+ </li>
338
+
339
+ <li>
340
+
341
+ <span class='name'>items_b</span>
342
+
343
+
344
+ <span class='type'>(<tt>Array</tt>)</span>
345
+
346
+
347
+
348
+ &mdash;
349
+ <div class='inline'>
350
+ <p>List of items to diff.</p>
351
+ </div>
352
+
353
+ </li>
354
+
355
+ <li>
356
+
357
+ <span class='name'>opts</span>
358
+
359
+
360
+ <span class='type'>(<tt>Hash</tt>)</span>
361
+
362
+
363
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
364
+
365
+
366
+ &mdash;
367
+ <div class='inline'>
368
+ <p>({}) Configuration options.</p>
369
+ </div>
370
+
371
+ </li>
372
+
373
+ </ul>
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
383
+ <ul class="option">
384
+
385
+ <li>
386
+ <span class="name">:exact_match</span>
387
+ <span class="type">(<tt>Boolean</tt>)</span>
388
+ <span class="default">
389
+
390
+ &mdash; default:
391
+ <tt>true</tt>
392
+
393
+ </span>
394
+
395
+ &mdash; <div class='inline'>
396
+ <p>Fragmenent should match element exactly.</p>
397
+ </div>
398
+
399
+ </li>
400
+
401
+ <li>
402
+ <span class="name">:deep_stringify</span>
403
+ <span class="type">(<tt>Boolean</tt>)</span>
404
+ <span class="default">
405
+
406
+ </span>
407
+
408
+ &mdash; <div class='inline'>
409
+ <p>If `true` then stringify all hash keys including sublevels before matching.</p>
410
+ </div>
411
+
412
+ </li>
413
+
414
+ <li>
415
+ <span class="name">:sanitize</span>
416
+ <span class="type">(<tt>Boolean</tt>)</span>
417
+ <span class="default">
418
+
419
+ &mdash; default:
420
+ <tt>true</tt>
421
+
422
+ </span>
423
+
424
+ &mdash; <div class='inline'>
425
+ <p>Sanitize element and filters when `true`.</p>
426
+ </div>
427
+
428
+ </li>
429
+
430
+ <li>
431
+ <span class="name">:skip_keys</span>
432
+ <span class="type">(<tt>Array</tt>, <tt>nil</tt>)</span>
433
+ <span class="default">
434
+
435
+ &mdash; default:
436
+ <tt>nil</tt>
437
+
438
+ </span>
439
+
440
+ &mdash; <div class='inline'>
441
+ <p>Keys to skip on match.</p>
442
+ </div>
443
+
444
+ </li>
445
+
446
+ <li>
447
+ <span class="name">:compare_way</span>
448
+ <span class="type">(<tt>Symbol</tt>)</span>
449
+ <span class="default">
450
+
451
+ &mdash; default:
452
+ <tt>:both</tt>
453
+
454
+ </span>
455
+
456
+ &mdash; <div class='inline'>
457
+ <p>Comparison way sense:</p>
458
+ <ul><li>
459
+ <p>`:both` Compare left and right.</p>
460
+ </li><li>
461
+ <p>`:right` Compare if `items_a` are inside `items_b`.</p>
462
+ </li><li>
463
+ <p>`:left` Compare if `items_b` are inside `items_a`.</p>
464
+ </li></ul>
465
+ </div>
466
+
467
+ </li>
468
+
469
+ </ul>
470
+
471
+
472
+ <p class="tag_title">Returns:</p>
473
+ <ul class="return">
474
+
475
+ <li>
476
+
477
+
478
+ <span class='type'>(<tt>Hash</tt>)</span>
479
+
480
+
481
+
482
+ &mdash;
483
+ <div class='inline'>
484
+ <p>Diff results as follows:</p>
485
+ <ul><li>
486
+ <p>`[Array] :items_a` Diff items on `items_a` collection.</p>
487
+ </li><li>
488
+ <p>`[Array] :items_b` Diff items on `items_b` collection.</p>
489
+ </li><li>
490
+ <p>`[Boolean] :match` `true` when all items match else `false`.</p>
491
+ </li></ul>
492
+ </div>
493
+
494
+ </li>
495
+
496
+ </ul>
497
+ <p class="tag_title">Raises:</p>
498
+ <ul class="raise">
499
+
500
+ <li>
501
+
502
+
503
+ <span class='type'>(<tt>NotImplementedError</tt>)</span>
504
+
505
+
506
+
507
+ </li>
508
+
509
+ </ul>
510
+
511
+ </div><table class="source_code">
512
+ <tr>
513
+ <td>
514
+ <pre class="lines">
515
+
516
+
517
+ 121
518
+ 122
519
+ 123
520
+ 124
521
+ 125
522
+ 126
523
+ 127
524
+ 128
525
+ 129
526
+ 130
527
+ 131
528
+ 132
529
+ 133
530
+ 134
531
+ 135
532
+ 136
533
+ 137
534
+ 138
535
+ 139
536
+ 140
537
+ 141
538
+ 142
539
+ 143
540
+ 144
541
+ 145
542
+ 146
543
+ 147
544
+ 148
545
+ 149
546
+ 150
547
+ 151
548
+ 152
549
+ 153
550
+ 154
551
+ 155
552
+ 156
553
+ 157
554
+ 158</pre>
555
+ </td>
556
+ <td>
557
+ <pre class="code"><span class="info file"># File 'lib/ae_easy/test/helper.rb', line 121</span>
558
+
559
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_collection_diff'>collection_diff</span> <span class='id identifier rubyid_items_a'>items_a</span><span class='comma'>,</span> <span class='id identifier rubyid_items_b'>items_b</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
560
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Current status WIP, don\&#39;t use it for now.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
561
+ <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
562
+ <span class='label'>exact_match:</span> <span class='kw'>true</span><span class='comma'>,</span>
563
+ <span class='label'>deep_stringify:</span> <span class='kw'>true</span><span class='comma'>,</span>
564
+ <span class='label'>sanitize:</span> <span class='kw'>true</span><span class='comma'>,</span>
565
+ <span class='label'>skip_keys:</span> <span class='kw'>nil</span><span class='comma'>,</span>
566
+ <span class='label'>compare_way:</span> <span class='symbol'>:both</span>
567
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_opts'>opts</span>
568
+
569
+ <span class='comment'># Match collections items
570
+ </span> <span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='kw'>nil</span>
571
+ <span class='id identifier rubyid_compare_right'>compare_right</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:compare_way</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:right</span> <span class='op'>||</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:compare_way</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:both</span>
572
+ <span class='id identifier rubyid_compare_left'>compare_left</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:compare_way</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:left</span> <span class='op'>||</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:compare_way</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='symbol'>:both</span>
573
+ <span class='id identifier rubyid_items_a'>items_a</span> <span class='op'>=</span> <span class='id identifier rubyid_items_a'>items_a</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='rbrace'>}</span>
574
+ <span class='id identifier rubyid_items_b'>items_b</span> <span class='op'>=</span> <span class='id identifier rubyid_items_b'>items_b</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span><span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='rbrace'>}</span>
575
+ <span class='id identifier rubyid_remaining_items'>remaining_items</span> <span class='op'>=</span> <span class='id identifier rubyid_items_b'>items_b</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
576
+ <span class='id identifier rubyid_not_found'>not_found</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
577
+ <span class='id identifier rubyid_items_a'>items_a</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_item_a'>item_a</span><span class='op'>|</span>
578
+ <span class='id identifier rubyid_found'>found</span> <span class='op'>=</span> <span class='id identifier rubyid_remaining_items'>remaining_items</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_b'>item_b</span><span class='op'>|</span>
579
+ <span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='kw'>false</span>
580
+ <span class='id identifier rubyid_match'>match</span> <span class='op'>||=</span> <span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='id identifier rubyid_item_a'>item_a</span><span class='comma'>,</span> <span class='id identifier rubyid_item_b'>item_b</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_compare_left'>compare_left</span>
581
+ <span class='id identifier rubyid_match'>match</span> <span class='op'>||=</span> <span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='id identifier rubyid_item_b'>item_b</span><span class='comma'>,</span> <span class='id identifier rubyid_item_a'>item_a</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_compare_right'>compare_right</span>
582
+ <span class='id identifier rubyid_match'>match</span>
583
+ <span class='kw'>end</span>
584
+
585
+ <span class='comment'># Save diff
586
+ </span> <span class='id identifier rubyid_not_found'>not_found</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_item_a'>item_a</span> <span class='kw'>if</span> <span class='id identifier rubyid_found'>found</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
587
+ <span class='id identifier rubyid_remaining_items'>remaining_items</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_found'>found</span>
588
+ <span class='kw'>end</span>
589
+
590
+ <span class='comment'># Send diff results
591
+ </span> <span class='lbrace'>{</span>
592
+ <span class='label'>items_a:</span> <span class='id identifier rubyid_not_found'>not_found</span><span class='comma'>,</span>
593
+ <span class='label'>items_b:</span> <span class='id identifier rubyid_remaining_items'>remaining_items</span><span class='comma'>,</span>
594
+ <span class='label'>match:</span> <span class='lparen'>(</span><span class='id identifier rubyid_not_found'>not_found</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_remaining_items'>remaining_items</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>1</span><span class='rparen'>)</span>
595
+ <span class='rbrace'>}</span>
596
+ <span class='kw'>end</span></pre>
597
+ </td>
598
+ </tr>
599
+ </table>
600
+ </div>
601
+
602
+ <div class="method_details ">
603
+ <h3 class="signature " id="collection_match?-class_method">
604
+
605
+ .<strong>collection_match?</strong>(fragment, universe, opts = {}) &#x21d2; <tt>Boolean</tt>
606
+
607
+
608
+
609
+
610
+
611
+ </h3><div class="docstring">
612
+ <div class="discussion">
613
+
614
+ <p>Validate when an item collection match universe item collection.</p>
615
+
616
+
617
+ </div>
618
+ </div>
619
+ <div class="tags">
620
+ <p class="tag_title">Parameters:</p>
621
+ <ul class="param">
622
+
623
+ <li>
624
+
625
+ <span class='name'>fragment</span>
626
+
627
+
628
+ <span class='type'>(<tt>Array</tt>)</span>
629
+
630
+
631
+
632
+ &mdash;
633
+ <div class='inline'>
634
+ <p>Fragment of universe items to match.</p>
635
+ </div>
636
+
637
+ </li>
638
+
639
+ <li>
640
+
641
+ <span class='name'>universe</span>
642
+
643
+
644
+ <span class='type'>(<tt>Array</tt>)</span>
645
+
646
+
647
+
648
+ &mdash;
649
+ <div class='inline'>
650
+ <p>List of items.</p>
651
+ </div>
652
+
653
+ </li>
654
+
655
+ <li>
656
+
657
+ <span class='name'>opts</span>
658
+
659
+
660
+ <span class='type'>(<tt>Hash</tt>)</span>
661
+
662
+
663
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
664
+
665
+
666
+ &mdash;
667
+ <div class='inline'>
668
+ <p>({}) Configuration options.</p>
669
+ </div>
670
+
671
+ </li>
672
+
673
+ </ul>
674
+
675
+
676
+
677
+
678
+
679
+
680
+
681
+
682
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
683
+ <ul class="option">
684
+
685
+ <li>
686
+ <span class="name">:exact_match</span>
687
+ <span class="type">(<tt>Boolean</tt>)</span>
688
+ <span class="default">
689
+
690
+ &mdash; default:
691
+ <tt>true</tt>
692
+
693
+ </span>
694
+
695
+ &mdash; <div class='inline'>
696
+ <p>Fragmenent should match element exactly.</p>
697
+ </div>
698
+
699
+ </li>
700
+
701
+ <li>
702
+ <span class="name">:same_count</span>
703
+ <span class="type">(<tt>Boolean</tt>)</span>
704
+ <span class="default">
705
+
706
+ &mdash; default:
707
+ <tt>true</tt>
708
+
709
+ </span>
710
+
711
+ &mdash; <div class='inline'>
712
+ <p>Fragment item count should match universe item count exactly.</p>
713
+ </div>
714
+
715
+ </li>
716
+
717
+ <li>
718
+ <span class="name">:deep_stringify</span>
719
+ <span class="type">(<tt>Boolean</tt>)</span>
720
+ <span class="default">
721
+
722
+ </span>
723
+
724
+ &mdash; <div class='inline'>
725
+ <p>If `true` then stringify all hash keys including sublevels before matching.</p>
726
+ </div>
727
+
728
+ </li>
729
+
730
+ <li>
731
+ <span class="name">:sanitize</span>
732
+ <span class="type">(<tt>Boolean</tt>)</span>
733
+ <span class="default">
734
+
735
+ &mdash; default:
736
+ <tt>true</tt>
737
+
738
+ </span>
739
+
740
+ &mdash; <div class='inline'>
741
+ <p>Sanitize element and filters when `true`.</p>
742
+ </div>
743
+
744
+ </li>
745
+
746
+ <li>
747
+ <span class="name">:skip_keys</span>
748
+ <span class="type">(<tt>Array</tt>, <tt>nil</tt>)</span>
749
+ <span class="default">
750
+
751
+ &mdash; default:
752
+ <tt>nil</tt>
753
+
754
+ </span>
755
+
756
+ &mdash; <div class='inline'>
757
+ <p>Keys to skip on match.</p>
758
+ </div>
759
+
760
+ </li>
761
+
762
+ <li>
763
+ <span class="name">:compare_way</span>
764
+ <span class="type">(<tt>Symbol</tt>)</span>
765
+ <span class="default">
766
+
767
+ &mdash; default:
768
+ <tt>:both</tt>
769
+
770
+ </span>
771
+
772
+ &mdash; <div class='inline'>
773
+ <p>Comparison way sense:</p>
774
+ <ul><li>
775
+ <p>`:both` Compare left and right.</p>
776
+ </li><li>
777
+ <p>`:right` Compare if `items_a` are inside `items_b`.</p>
778
+ </li><li>
779
+ <p>`:left` Compare if `items_b` are inside `items_a`.</p>
780
+ </li></ul>
781
+ </div>
782
+
783
+ </li>
784
+
785
+ </ul>
786
+
787
+
788
+ <p class="tag_title">Returns:</p>
789
+ <ul class="return">
790
+
791
+ <li>
792
+
793
+
794
+ <span class='type'>(<tt>Boolean</tt>)</span>
795
+
796
+
797
+
798
+ </li>
799
+
800
+ </ul>
801
+
802
+ </div><table class="source_code">
803
+ <tr>
804
+ <td>
805
+ <pre class="lines">
806
+
807
+
808
+ 180
809
+ 181
810
+ 182
811
+ 183
812
+ 184
813
+ 185
814
+ 186
815
+ 187
816
+ 188
817
+ 189
818
+ 190
819
+ 191
820
+ 192
821
+ 193
822
+ 194
823
+ 195
824
+ 196</pre>
825
+ </td>
826
+ <td>
827
+ <pre class="code"><span class="info file"># File 'lib/ae_easy/test/helper.rb', line 180</span>
828
+
829
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_collection_match?'>collection_match?</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='comma'>,</span> <span class='id identifier rubyid_universe'>universe</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
830
+ <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
831
+ <span class='label'>exact_match:</span> <span class='kw'>true</span><span class='comma'>,</span>
832
+ <span class='label'>same_count:</span> <span class='kw'>true</span><span class='comma'>,</span>
833
+ <span class='label'>deep_stringify:</span> <span class='kw'>true</span><span class='comma'>,</span>
834
+ <span class='label'>sanitize:</span> <span class='kw'>true</span><span class='comma'>,</span>
835
+ <span class='label'>skip_keys:</span> <span class='kw'>nil</span><span class='comma'>,</span>
836
+ <span class='label'>compare_way:</span> <span class='symbol'>:both</span>
837
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_opts'>opts</span>
838
+
839
+ <span class='comment'># False when item collections count are different
840
+ </span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:match_quantity</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>!=</span> <span class='id identifier rubyid_universe'>universe</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span>
841
+
842
+ <span class='id identifier rubyid_diff'>diff</span> <span class='op'>=</span> <span class='id identifier rubyid_collection_diff'>collection_diff</span> <span class='id identifier rubyid_fragment'>fragment</span><span class='comma'>,</span> <span class='id identifier rubyid_universe'>universe</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span>
843
+ <span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='id identifier rubyid_diff'>diff</span><span class='lbracket'>[</span><span class='symbol'>:items_a</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_diff'>diff</span><span class='lbracket'>[</span><span class='symbol'>:items_b</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>1</span>
844
+ <span class='id identifier rubyid_match'>match</span>
845
+ <span class='kw'>end</span></pre>
846
+ </td>
847
+ </tr>
848
+ </table>
849
+ </div>
850
+
851
+ <div class="method_details ">
852
+ <h3 class="signature " id="delete_keys_from!-class_method">
853
+
854
+ .<strong>delete_keys_from!</strong>(hash, keys) &#x21d2; <tt>Hash</tt>
855
+
856
+
857
+
858
+
859
+
860
+ </h3><div class="docstring">
861
+ <div class="discussion">
862
+
863
+ <p>Delete keys from a hash.</p>
864
+
865
+
866
+ </div>
867
+ </div>
868
+ <div class="tags">
869
+ <p class="tag_title">Parameters:</p>
870
+ <ul class="param">
871
+
872
+ <li>
873
+
874
+ <span class='name'>hash</span>
875
+
876
+
877
+ <span class='type'>(<tt>Hash</tt>)</span>
878
+
879
+
880
+
881
+ &mdash;
882
+ <div class='inline'>
883
+ <p>Base hash to exclude from.</p>
884
+ </div>
885
+
886
+ </li>
887
+
888
+ <li>
889
+
890
+ <span class='name'>keys</span>
891
+
892
+
893
+ <span class='type'>(<tt>Array</tt>)</span>
894
+
895
+
896
+
897
+ &mdash;
898
+ <div class='inline'>
899
+ <p>Keys to exclude.</p>
900
+ </div>
901
+
902
+ </li>
903
+
904
+ </ul>
905
+
906
+ <p class="tag_title">Returns:</p>
907
+ <ul class="return">
908
+
909
+ <li>
910
+
911
+
912
+ <span class='type'>(<tt>Hash</tt>)</span>
913
+
914
+
915
+
916
+ </li>
917
+
918
+ </ul>
919
+
920
+ </div><table class="source_code">
921
+ <tr>
922
+ <td>
923
+ <pre class="lines">
924
+
925
+
926
+ 33
927
+ 34
928
+ 35
929
+ 36
930
+ 37</pre>
931
+ </td>
932
+ <td>
933
+ <pre class="code"><span class="info file"># File 'lib/ae_easy/test/helper.rb', line 33</span>
934
+
935
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete_keys_from!'>delete_keys_from!</span> <span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='id identifier rubyid_keys'>keys</span>
936
+ <span class='kw'>return</span> <span class='id identifier rubyid_hash'>hash</span> <span class='kw'>if</span> <span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
937
+ <span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_k'>k</span><span class='rbrace'>}</span>
938
+ <span class='id identifier rubyid_hash'>hash</span>
939
+ <span class='kw'>end</span></pre>
940
+ </td>
941
+ </tr>
942
+ </table>
943
+ </div>
944
+
945
+ <div class="method_details ">
946
+ <h3 class="signature " id="load_file-class_method">
947
+
948
+ .<strong>load_file</strong>(file_path, should_exists = false) &#x21d2; <tt>String</tt><sup>?</sup>
949
+
950
+
951
+
952
+
953
+
954
+ </h3><div class="docstring">
955
+ <div class="discussion">
956
+
957
+ <p>Load and return file contents when exists.</p>
958
+
959
+
960
+ </div>
961
+ </div>
962
+ <div class="tags">
963
+ <p class="tag_title">Parameters:</p>
964
+ <ul class="param">
965
+
966
+ <li>
967
+
968
+ <span class='name'>file_path</span>
969
+
970
+
971
+ <span class='type'>(<tt>String</tt>)</span>
972
+
973
+
974
+
975
+ &mdash;
976
+ <div class='inline'>
977
+ <p>File path to load.</p>
978
+ </div>
979
+
980
+ </li>
981
+
982
+ <li>
983
+
984
+ <span class='name'>should_exists</span>
985
+
986
+
987
+ <span class='type'>(<tt>Boolean</tt>)</span>
988
+
989
+
990
+ <em class="default">(defaults to: <tt>false</tt>)</em>
991
+
992
+
993
+ &mdash;
994
+ <div class='inline'>
995
+ <p>(false) Enforce file existance validation.</p>
996
+ </div>
997
+
998
+ </li>
999
+
1000
+ </ul>
1001
+
1002
+ <p class="tag_title">Returns:</p>
1003
+ <ul class="return">
1004
+
1005
+ <li>
1006
+
1007
+
1008
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
1009
+
1010
+
1011
+
1012
+ &mdash;
1013
+ <div class='inline'>
1014
+ <p>File contents.</p>
1015
+ </div>
1016
+
1017
+ </li>
1018
+
1019
+ </ul>
1020
+
1021
+ </div><table class="source_code">
1022
+ <tr>
1023
+ <td>
1024
+ <pre class="lines">
1025
+
1026
+
1027
+ 10
1028
+ 11
1029
+ 12
1030
+ 13</pre>
1031
+ </td>
1032
+ <td>
1033
+ <pre class="code"><span class="info file"># File 'lib/ae_easy/test/helper.rb', line 10</span>
1034
+
1035
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_should_exists'>should_exists</span> <span class='op'>=</span> <span class='kw'>false</span>
1036
+ <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_should_exists'>should_exists</span> <span class='op'>||</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
1037
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>r</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>encoding:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span>
1038
+ <span class='kw'>end</span></pre>
1039
+ </td>
1040
+ </tr>
1041
+ </table>
1042
+ </div>
1043
+
1044
+ <div class="method_details ">
1045
+ <h3 class="signature " id="load_json_file-class_method">
1046
+
1047
+ .<strong>load_json_file</strong>(file_path, should_exists = false) &#x21d2; <tt>Hash</tt><sup>?</sup>
1048
+
1049
+
1050
+
1051
+
1052
+
1053
+ </h3><div class="docstring">
1054
+ <div class="discussion">
1055
+
1056
+ <p>Load and return file contents as json when exists.</p>
1057
+
1058
+
1059
+ </div>
1060
+ </div>
1061
+ <div class="tags">
1062
+ <p class="tag_title">Parameters:</p>
1063
+ <ul class="param">
1064
+
1065
+ <li>
1066
+
1067
+ <span class='name'>file_path</span>
1068
+
1069
+
1070
+ <span class='type'>(<tt>String</tt>)</span>
1071
+
1072
+
1073
+
1074
+ &mdash;
1075
+ <div class='inline'>
1076
+ <p>File path to load.</p>
1077
+ </div>
1078
+
1079
+ </li>
1080
+
1081
+ <li>
1082
+
1083
+ <span class='name'>should_exists</span>
1084
+
1085
+
1086
+ <span class='type'>(<tt>Boolean</tt>)</span>
1087
+
1088
+
1089
+ <em class="default">(defaults to: <tt>false</tt>)</em>
1090
+
1091
+
1092
+ &mdash;
1093
+ <div class='inline'>
1094
+ <p>(false) Enforce file existance validation.</p>
1095
+ </div>
1096
+
1097
+ </li>
1098
+
1099
+ </ul>
1100
+
1101
+ <p class="tag_title">Returns:</p>
1102
+ <ul class="return">
1103
+
1104
+ <li>
1105
+
1106
+
1107
+ <span class='type'>(<tt>Hash</tt>, <tt>nil</tt>)</span>
1108
+
1109
+
1110
+
1111
+ &mdash;
1112
+ <div class='inline'>
1113
+ <p>Json file contents.</p>
1114
+ </div>
1115
+
1116
+ </li>
1117
+
1118
+ </ul>
1119
+
1120
+ </div><table class="source_code">
1121
+ <tr>
1122
+ <td>
1123
+ <pre class="lines">
1124
+
1125
+
1126
+ 21
1127
+ 22
1128
+ 23
1129
+ 24
1130
+ 25</pre>
1131
+ </td>
1132
+ <td>
1133
+ <pre class="code"><span class="info file"># File 'lib/ae_easy/test/helper.rb', line 21</span>
1134
+
1135
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_json_file'>load_json_file</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_should_exists'>should_exists</span> <span class='op'>=</span> <span class='kw'>false</span>
1136
+ <span class='id identifier rubyid_file_content'>file_content</span> <span class='op'>=</span> <span class='id identifier rubyid_load_file'>load_file</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_should_exists'>should_exists</span>
1137
+ <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_file_content'>file_content</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_file_content'>file_content</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
1138
+ <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_file_content'>file_content</span><span class='rparen'>)</span>
1139
+ <span class='kw'>end</span></pre>
1140
+ </td>
1141
+ </tr>
1142
+ </table>
1143
+ </div>
1144
+
1145
+ <div class="method_details ">
1146
+ <h3 class="signature " id="match?-class_method">
1147
+
1148
+ .<strong>match?</strong>(element, filter, opts = {}) &#x21d2; <tt>Boolean</tt>
1149
+
1150
+
1151
+
1152
+
1153
+
1154
+ </h3><div class="docstring">
1155
+ <div class="discussion">
1156
+
1157
+ <p>Check if an hash element match the filter.</p>
1158
+
1159
+
1160
+ </div>
1161
+ </div>
1162
+ <div class="tags">
1163
+ <p class="tag_title">Parameters:</p>
1164
+ <ul class="param">
1165
+
1166
+ <li>
1167
+
1168
+ <span class='name'>element</span>
1169
+
1170
+
1171
+ <span class='type'>(<tt>Hash</tt>)</span>
1172
+
1173
+
1174
+
1175
+ &mdash;
1176
+ <div class='inline'>
1177
+ <p>Element to match.</p>
1178
+ </div>
1179
+
1180
+ </li>
1181
+
1182
+ <li>
1183
+
1184
+ <span class='name'>filter</span>
1185
+
1186
+
1187
+ <span class='type'>(<tt>Hash</tt>)</span>
1188
+
1189
+
1190
+
1191
+ &mdash;
1192
+ <div class='inline'>
1193
+ <p>Filters to apply.</p>
1194
+ </div>
1195
+
1196
+ </li>
1197
+
1198
+ <li>
1199
+
1200
+ <span class='name'>opts</span>
1201
+
1202
+
1203
+ <span class='type'>(<tt>Hash</tt>)</span>
1204
+
1205
+
1206
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
1207
+
1208
+
1209
+ &mdash;
1210
+ <div class='inline'>
1211
+ <p>({}) Configuration options.</p>
1212
+ </div>
1213
+
1214
+ </li>
1215
+
1216
+ </ul>
1217
+
1218
+
1219
+
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
1226
+ <ul class="option">
1227
+
1228
+ <li>
1229
+ <span class="name">:sanitize</span>
1230
+ <span class="type">(<tt>Boolean</tt>)</span>
1231
+ <span class="default">
1232
+
1233
+ &mdash; default:
1234
+ <tt>true</tt>
1235
+
1236
+ </span>
1237
+
1238
+ &mdash; <div class='inline'>
1239
+ <p>Sanitize element and filters when `true`.</p>
1240
+ </div>
1241
+
1242
+ </li>
1243
+
1244
+ <li>
1245
+ <span class="name">:deep_stringify</span>
1246
+ <span class="type">(<tt>Boolean</tt>)</span>
1247
+ <span class="default">
1248
+
1249
+ </span>
1250
+
1251
+ &mdash; <div class='inline'>
1252
+ <p>If `true` then stringify all hash keys including sublevels before matching.</p>
1253
+ </div>
1254
+
1255
+ </li>
1256
+
1257
+ <li>
1258
+ <span class="name">:exact_match</span>
1259
+ <span class="type">(<tt>Boolean</tt>)</span>
1260
+ <span class="default">
1261
+
1262
+ &mdash; default:
1263
+ <tt>true</tt>
1264
+
1265
+ </span>
1266
+
1267
+ &mdash; <div class='inline'>
1268
+ <p>Filter should match element exactly.</p>
1269
+ </div>
1270
+
1271
+ </li>
1272
+
1273
+ <li>
1274
+ <span class="name">:skip_keys</span>
1275
+ <span class="type">(<tt>Array</tt>, <tt>nil</tt>)</span>
1276
+ <span class="default">
1277
+
1278
+ &mdash; default:
1279
+ <tt>nil</tt>
1280
+
1281
+ </span>
1282
+
1283
+ &mdash; <div class='inline'>
1284
+ <p>Keys to skip on match.</p>
1285
+ </div>
1286
+
1287
+ </li>
1288
+
1289
+ </ul>
1290
+
1291
+
1292
+ <p class="tag_title">Returns:</p>
1293
+ <ul class="return">
1294
+
1295
+ <li>
1296
+
1297
+
1298
+ <span class='type'>(<tt>Boolean</tt>)</span>
1299
+
1300
+
1301
+
1302
+ &mdash;
1303
+ <div class='inline'>
1304
+ <p>`true` when element match filters, else `false`.</p>
1305
+ </div>
1306
+
1307
+ </li>
1308
+
1309
+ </ul>
1310
+
1311
+ </div><table class="source_code">
1312
+ <tr>
1313
+ <td>
1314
+ <pre class="lines">
1315
+
1316
+
1317
+ 74
1318
+ 75
1319
+ 76
1320
+ 77
1321
+ 78
1322
+ 79
1323
+ 80
1324
+ 81
1325
+ 82
1326
+ 83
1327
+ 84
1328
+ 85
1329
+ 86
1330
+ 87
1331
+ 88
1332
+ 89
1333
+ 90
1334
+ 91
1335
+ 92
1336
+ 93
1337
+ 94
1338
+ 95
1339
+ 96
1340
+ 97
1341
+ 98</pre>
1342
+ </td>
1343
+ <td>
1344
+ <pre class="code"><span class="info file"># File 'lib/ae_easy/test/helper.rb', line 74</span>
1345
+
1346
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span> <span class='id identifier rubyid_element'>element</span><span class='comma'>,</span> <span class='id identifier rubyid_filter'>filter</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1347
+ <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
1348
+ <span class='label'>sanitize:</span> <span class='kw'>true</span><span class='comma'>,</span>
1349
+ <span class='label'>deep_stringify:</span> <span class='kw'>true</span><span class='comma'>,</span>
1350
+ <span class='label'>exact_match:</span> <span class='kw'>true</span><span class='comma'>,</span>
1351
+ <span class='label'>skip_keys:</span> <span class='kw'>nil</span>
1352
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_opts'>opts</span>
1353
+
1354
+ <span class='comment'># Sanitize element and filter when need
1355
+ </span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:sanitize</span><span class='rbracket'>]</span>
1356
+ <span class='id identifier rubyid_element'>element</span> <span class='op'>=</span> <span class='id identifier rubyid_sanitize'>sanitize</span> <span class='id identifier rubyid_element'>element</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span>
1357
+ <span class='id identifier rubyid_filter'>filter</span> <span class='op'>=</span> <span class='id identifier rubyid_sanitize'>sanitize</span> <span class='id identifier rubyid_filter'>filter</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span>
1358
+ <span class='kw'>end</span>
1359
+
1360
+ <span class='comment'># Validate exact match when need
1361
+ </span> <span class='id identifier rubyid_exact_match'>exact_match</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:exact_match</span><span class='rbracket'>]</span>
1362
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_exact_match'>exact_match</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>!=</span> <span class='id identifier rubyid_filter'>filter</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span>
1363
+
1364
+ <span class='comment'># Match element filter
1365
+ </span> <span class='id identifier rubyid_filter'>filter</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_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
1366
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_exact_match'>exact_match</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='id identifier rubyid_element'>element</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
1367
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_element'>element</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='id identifier rubyid_v'>v</span>
1368
+ <span class='kw'>end</span>
1369
+ <span class='kw'>true</span>
1370
+ <span class='kw'>end</span></pre>
1371
+ </td>
1372
+ </tr>
1373
+ </table>
1374
+ </div>
1375
+
1376
+ <div class="method_details ">
1377
+ <h3 class="signature " id="match_collections-class_method">
1378
+
1379
+ .<strong>match_collections</strong>(items_a, items_b, opts = {}) &#x21d2; <tt>Hash</tt>
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+ </h3><div class="docstring">
1386
+ <div class="discussion">
1387
+
1388
+ <p>Match two collections and calculate diff.</p>
1389
+
1390
+
1391
+ </div>
1392
+ </div>
1393
+ <div class="tags">
1394
+ <p class="tag_title">Parameters:</p>
1395
+ <ul class="param">
1396
+
1397
+ <li>
1398
+
1399
+ <span class='name'>items_a</span>
1400
+
1401
+
1402
+ <span class='type'>(<tt>Array</tt>)</span>
1403
+
1404
+
1405
+
1406
+ &mdash;
1407
+ <div class='inline'>
1408
+ <p>Item collection to match.</p>
1409
+ </div>
1410
+
1411
+ </li>
1412
+
1413
+ <li>
1414
+
1415
+ <span class='name'>items_b</span>
1416
+
1417
+
1418
+ <span class='type'>(<tt>Array</tt>)</span>
1419
+
1420
+
1421
+
1422
+ &mdash;
1423
+ <div class='inline'>
1424
+ <p>Item collection to match.</p>
1425
+ </div>
1426
+
1427
+ </li>
1428
+
1429
+ <li>
1430
+
1431
+ <span class='name'>opts</span>
1432
+
1433
+
1434
+ <span class='type'>(<tt>Hash</tt>)</span>
1435
+
1436
+
1437
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
1438
+
1439
+
1440
+ &mdash;
1441
+ <div class='inline'>
1442
+ <p>({}) Configuration options.</p>
1443
+ </div>
1444
+
1445
+ </li>
1446
+
1447
+ </ul>
1448
+
1449
+
1450
+
1451
+
1452
+
1453
+
1454
+
1455
+
1456
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
1457
+ <ul class="option">
1458
+
1459
+ <li>
1460
+ <span class="name">:skip</span>
1461
+ <span class="type">(<tt>Array</tt>)</span>
1462
+ <span class="default">
1463
+
1464
+ &mdash; default:
1465
+ <tt>nil</tt>
1466
+
1467
+ </span>
1468
+
1469
+ &mdash; <div class='inline'>
1470
+ <p>Keys to skip on match.</p>
1471
+ </div>
1472
+
1473
+ </li>
1474
+
1475
+ <li>
1476
+ <span class="name">:compare_way</span>
1477
+ <span class="type">(<tt>Symbol</tt>)</span>
1478
+ <span class="default">
1479
+
1480
+ &mdash; default:
1481
+ <tt>:left</tt>
1482
+
1483
+ </span>
1484
+
1485
+ &mdash; <div class='inline'>
1486
+ <p>Comparison way sense:</p>
1487
+ <ul><li>
1488
+ <p>`:both` Compare left and right.</p>
1489
+ </li><li>
1490
+ <p>`:right` Compare if `items_a` are inside `items_b`.</p>
1491
+ </li><li>
1492
+ <p>`:left` Compare if `items_b` are inside `items_a`.</p>
1493
+ </li></ul>
1494
+ </div>
1495
+
1496
+ </li>
1497
+
1498
+ </ul>
1499
+
1500
+
1501
+ <p class="tag_title">Returns:</p>
1502
+ <ul class="return">
1503
+
1504
+ <li>
1505
+
1506
+
1507
+ <span class='type'>(<tt>Hash</tt>)</span>
1508
+
1509
+
1510
+
1511
+ &mdash;
1512
+ <div class='inline'>
1513
+ <p>A hash with the following key pairs:</p>
1514
+ <ul><li>
1515
+ <p>`[Hash] :diff` Diff results with `:items_a` and `:items_b` keys.</p>
1516
+ </li><li>
1517
+ <p>`[Boolean] :match` `true` when match else `false`.</p>
1518
+ </li></ul>
1519
+ </div>
1520
+
1521
+ </li>
1522
+
1523
+ </ul>
1524
+
1525
+ </div><table class="source_code">
1526
+ <tr>
1527
+ <td>
1528
+ <pre class="lines">
1529
+
1530
+
1531
+ 212
1532
+ 213
1533
+ 214
1534
+ 215
1535
+ 216
1536
+ 217
1537
+ 218
1538
+ 219
1539
+ 220
1540
+ 221</pre>
1541
+ </td>
1542
+ <td>
1543
+ <pre class="code"><span class="info file"># File 'lib/ae_easy/test/helper.rb', line 212</span>
1544
+
1545
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_match_collections'>match_collections</span> <span class='id identifier rubyid_items_a'>items_a</span><span class='comma'>,</span> <span class='id identifier rubyid_items_b'>items_b</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1546
+ <span class='id identifier rubyid_diff'>diff</span> <span class='op'>=</span> <span class='id identifier rubyid_collection_diff'>collection_diff</span><span class='lparen'>(</span>
1547
+ <span class='id identifier rubyid_items_a'>items_a</span><span class='comma'>,</span>
1548
+ <span class='id identifier rubyid_items_b'>items_b</span><span class='comma'>,</span>
1549
+ <span class='label'>skip_keys:</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:skip</span><span class='rbracket'>]</span><span class='comma'>,</span>
1550
+ <span class='label'>compare_way:</span> <span class='symbol'>:both</span>
1551
+ <span class='rparen'>)</span>
1552
+ <span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_diff'>diff</span><span class='lbracket'>[</span><span class='symbol'>:items_a</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>1</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_diff'>diff</span><span class='lbracket'>[</span><span class='symbol'>:items_b</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>1</span><span class='rparen'>)</span>
1553
+ <span class='lbrace'>{</span><span class='label'>diff:</span> <span class='id identifier rubyid_diff'>diff</span><span class='comma'>,</span> <span class='label'>match:</span> <span class='id identifier rubyid_diff'>diff</span><span class='lbracket'>[</span><span class='symbol'>:match</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
1554
+ <span class='kw'>end</span></pre>
1555
+ </td>
1556
+ </tr>
1557
+ </table>
1558
+ </div>
1559
+
1560
+ <div class="method_details ">
1561
+ <h3 class="signature " id="sanitize-class_method">
1562
+
1563
+ .<strong>sanitize</strong>(raw_hash, opts) &#x21d2; <tt>Hash</tt>
1564
+
1565
+
1566
+
1567
+
1568
+
1569
+ </h3><div class="docstring">
1570
+ <div class="discussion">
1571
+
1572
+ <p>Sanitize a copy of the hash provided.</p>
1573
+
1574
+
1575
+ </div>
1576
+ </div>
1577
+ <div class="tags">
1578
+ <p class="tag_title">Parameters:</p>
1579
+ <ul class="param">
1580
+
1581
+ <li>
1582
+
1583
+ <span class='name'>raw_hash</span>
1584
+
1585
+
1586
+ <span class='type'>(<tt>Hash</tt>)</span>
1587
+
1588
+
1589
+
1590
+ &mdash;
1591
+ <div class='inline'>
1592
+ <p>Hash to sanitize.</p>
1593
+ </div>
1594
+
1595
+ </li>
1596
+
1597
+ <li>
1598
+
1599
+ <span class='name'>opts</span>
1600
+
1601
+
1602
+ <span class='type'>(<tt>Hash</tt>)</span>
1603
+
1604
+
1605
+
1606
+ &mdash;
1607
+ <div class='inline'>
1608
+ <p>({}) Configuration options.</p>
1609
+ </div>
1610
+
1611
+ </li>
1612
+
1613
+ </ul>
1614
+
1615
+
1616
+
1617
+
1618
+
1619
+
1620
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
1621
+ <ul class="option">
1622
+
1623
+ <li>
1624
+ <span class="name">:deep_stringify</span>
1625
+ <span class="type">(<tt>Boolean</tt>)</span>
1626
+ <span class="default">
1627
+
1628
+ </span>
1629
+
1630
+ &mdash; <div class='inline'>
1631
+ <p>If `true` then stringify all hash keys including sublevels.</p>
1632
+ </div>
1633
+
1634
+ </li>
1635
+
1636
+ <li>
1637
+ <span class="name">:skip_keys</span>
1638
+ <span class="type">(<tt>Array</tt>, <tt>nil</tt>)</span>
1639
+ <span class="default">
1640
+
1641
+ &mdash; default:
1642
+ <tt>nil</tt>
1643
+
1644
+ </span>
1645
+
1646
+ &mdash; <div class='inline'>
1647
+ <p>Key array to delete from sanitized hash clone.</p>
1648
+ </div>
1649
+
1650
+ </li>
1651
+
1652
+ </ul>
1653
+
1654
+
1655
+ <p class="tag_title">Returns:</p>
1656
+ <ul class="return">
1657
+
1658
+ <li>
1659
+
1660
+
1661
+ <span class='type'>(<tt>Hash</tt>)</span>
1662
+
1663
+
1664
+
1665
+ &mdash;
1666
+ <div class='inline'>
1667
+ <p>Sanitized hash clone.</p>
1668
+ </div>
1669
+
1670
+ </li>
1671
+
1672
+ </ul>
1673
+
1674
+ </div><table class="source_code">
1675
+ <tr>
1676
+ <td>
1677
+ <pre class="lines">
1678
+
1679
+
1680
+ 49
1681
+ 50
1682
+ 51
1683
+ 52
1684
+ 53
1685
+ 54
1686
+ 55
1687
+ 56
1688
+ 57
1689
+ 58</pre>
1690
+ </td>
1691
+ <td>
1692
+ <pre class="code"><span class="info file"># File 'lib/ae_easy/test/helper.rb', line 49</span>
1693
+
1694
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_sanitize'>sanitize</span> <span class='id identifier rubyid_raw_hash'>raw_hash</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span>
1695
+ <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
1696
+ <span class='label'>deep_stringify:</span> <span class='kw'>true</span><span class='comma'>,</span>
1697
+ <span class='label'>skip_keys:</span> <span class='kw'>nil</span>
1698
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_opts'>opts</span>
1699
+ <span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:deep_stringify</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>?</span>
1700
+ <span class='const'><span class='object_link'><a href="../../AeEasy.html" title="AeEasy (module)">AeEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Core.html" title="AeEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_deep_stringify_keys'>deep_stringify_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_hash'>raw_hash</span><span class='rparen'>)</span> <span class='op'>:</span>
1701
+ <span class='const'><span class='object_link'><a href="../../AeEasy.html" title="AeEasy (module)">AeEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Core.html" title="AeEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_deep_clone'>deep_clone</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_hash'>raw_hash</span><span class='rparen'>)</span>
1702
+ <span class='id identifier rubyid_delete_keys_from!'>delete_keys_from!</span> <span class='id identifier rubyid_hash'>hash</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:skip_keys</span><span class='rbracket'>]</span>
1703
+ <span class='kw'>end</span></pre>
1704
+ </td>
1705
+ </tr>
1706
+ </table>
1707
+ </div>
1708
+
1709
+ </div>
1710
+
1711
+ </div>
1712
+
1713
+ <div id="footer">
1714
+ Generated on Fri Mar 8 17:49:24 2019 by
1715
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1716
+ 0.9.18 (ruby-2.5.3).
1717
+ </div>
1718
+
1719
+ </div>
1720
+ </body>
1721
+ </html>