qo 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +5 -5
  2. data/.yardopts +3 -0
  3. data/README.md +35 -2
  4. data/Rakefile +65 -13
  5. data/docs/Qo.html +165 -0
  6. data/docs/Qo/Exceptions.html +160 -0
  7. data/docs/Qo/Exceptions/MultipleMatchersProvided.html +257 -0
  8. data/docs/Qo/Exceptions/NoMatchersProvided.html +257 -0
  9. data/docs/Qo/Exceptions/NotAllGuardMatchersProvided.html +260 -0
  10. data/docs/Qo/Helpers.html +382 -0
  11. data/docs/Qo/Matchers.html +169 -0
  12. data/docs/Qo/Matchers/ArrayMatcher.html +459 -0
  13. data/docs/Qo/Matchers/BaseMatcher.html +493 -0
  14. data/docs/Qo/Matchers/GuardBlockMatcher.html +471 -0
  15. data/docs/Qo/Matchers/HashMatcher.html +445 -0
  16. data/docs/Qo/Matchers/PatternMatch.html +551 -0
  17. data/docs/Qo/PublicApi.html +867 -0
  18. data/docs/_index.html +258 -0
  19. data/docs/class_list.html +51 -0
  20. data/docs/css/common.css +1 -0
  21. data/docs/css/full_list.css +58 -0
  22. data/docs/css/style.css +499 -0
  23. data/docs/file.README.html +701 -0
  24. data/docs/file_list.html +56 -0
  25. data/docs/frames.html +17 -0
  26. data/docs/img/qo_logo.png +0 -0
  27. data/docs/index.html +701 -0
  28. data/docs/js/app.js +248 -0
  29. data/docs/js/full_list.js +216 -0
  30. data/docs/js/jquery.js +4 -0
  31. data/docs/method_list.html +227 -0
  32. data/docs/top-level-namespace.html +110 -0
  33. data/img/whoa_lemur.png +0 -0
  34. data/lib/qo/exceptions.rb +8 -4
  35. data/lib/qo/matchers/array_matcher.rb +34 -12
  36. data/lib/qo/matchers/base_matcher.rb +26 -11
  37. data/lib/qo/matchers/guard_block_matcher.rb +17 -3
  38. data/lib/qo/matchers/hash_matcher.rb +32 -23
  39. data/lib/qo/matchers/pattern_match.rb +2 -1
  40. data/lib/qo/public_api.rb +6 -5
  41. data/lib/qo/version.rb +1 -1
  42. data/performance_report.txt +73 -24
  43. data/qo.gemspec +2 -0
  44. metadata +61 -3
@@ -0,0 +1,260 @@
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
+ Exception: Qo::Exceptions::NotAllGuardMatchersProvided
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 = "Qo::Exceptions::NotAllGuardMatchersProvided";
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 (N)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Qo.html" title="Qo (module)">Qo</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Exceptions.html" title="Qo::Exceptions (module)">Exceptions</a></span></span>
41
+ &raquo;
42
+ <span class="title">NotAllGuardMatchersProvided</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>Exception: Qo::Exceptions::NotAllGuardMatchersProvided
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">ArgumentError</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">ArgumentError</li>
78
+
79
+ <li class="next">Qo::Exceptions::NotAllGuardMatchersProvided</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/qo/exceptions.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p>In the case of a Pattern Match, we need to ensure all arguments are
107
+ GuardBlockMatchers.</p>
108
+
109
+
110
+ </div>
111
+ </div>
112
+ <div class="tags">
113
+
114
+ <p class="tag_title">Author:</p>
115
+ <ul class="author">
116
+
117
+ <li>
118
+
119
+
120
+
121
+
122
+
123
+ <div class='inline'><p>baweaver</p>
124
+ </div>
125
+
126
+ </li>
127
+
128
+ </ul>
129
+ <p class="tag_title">Since:</p>
130
+ <ul class="since">
131
+
132
+ <li>
133
+
134
+
135
+
136
+
137
+
138
+ <div class='inline'><p>0.2.0</p>
139
+ </div>
140
+
141
+ </li>
142
+
143
+ </ul>
144
+
145
+ </div>
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+ <h2>
154
+ Instance Method Summary
155
+ <small><a href="#" class="summary_toggle">collapse</a></small>
156
+ </h2>
157
+
158
+ <ul class="summary">
159
+
160
+ <li class="public ">
161
+ <span class="summary_signature">
162
+
163
+ <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
164
+
165
+
166
+
167
+ </span>
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+ <span class="summary_desc"><div class='inline'></div></span>
178
+
179
+ </li>
180
+
181
+
182
+ </ul>
183
+
184
+
185
+
186
+
187
+
188
+ <div id="instance_method_details" class="method_details_list">
189
+ <h2>Instance Method Details</h2>
190
+
191
+
192
+ <div class="method_details first">
193
+ <h3 class="signature first" id="to_s-instance_method">
194
+
195
+ #<strong>to_s</strong> &#x21d2; <tt>Object</tt>
196
+
197
+
198
+
199
+
200
+
201
+ </h3><div class="docstring">
202
+ <div class="discussion">
203
+
204
+
205
+ </div>
206
+ </div>
207
+ <div class="tags">
208
+
209
+ <p class="tag_title">Since:</p>
210
+ <ul class="since">
211
+
212
+ <li>
213
+
214
+
215
+
216
+
217
+
218
+ <div class='inline'><p>0.2.0</p>
219
+ </div>
220
+
221
+ </li>
222
+
223
+ </ul>
224
+
225
+ </div><table class="source_code">
226
+ <tr>
227
+ <td>
228
+ <pre class="lines">
229
+
230
+
231
+ 37
232
+ 38
233
+ 39
234
+ 40</pre>
235
+ </td>
236
+ <td>
237
+ <pre class="code"><span class="info file"># File 'lib/qo/exceptions.rb', line 37</span>
238
+
239
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
240
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>All provided matchers must be of type Qo::Matchers::GuardBlockMatcher </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span>
241
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>defined with `Qo.matcher` or `Qo.m` instead of regular matchers.</span><span class='tstring_end'>&quot;</span></span>
242
+ <span class='kw'>end</span></pre>
243
+ </td>
244
+ </tr>
245
+ </table>
246
+ </div>
247
+
248
+ </div>
249
+
250
+ </div>
251
+
252
+ <div id="footer">
253
+ Generated on Sun Apr 15 20:29:44 2018 by
254
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
255
+ 0.9.12 (ruby-2.4.4).
256
+ </div>
257
+
258
+ </div>
259
+ </body>
260
+ </html>
@@ -0,0 +1,382 @@
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: Qo::Helpers
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 = "Qo::Helpers";
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="../Qo.html" title="Qo (module)">Qo</a></span></span>
41
+ &raquo;
42
+ <span class="title">Helpers</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: Qo::Helpers
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dl>
78
+ <dt>Included in:</dt>
79
+ <dd><span class='object_link'><a href="../Qo.html" title="Qo (module)">Qo</a></span></dd>
80
+ </dl>
81
+
82
+
83
+
84
+ <dl>
85
+ <dt>Defined in:</dt>
86
+ <dd>lib/qo/helpers.rb</dd>
87
+ </dl>
88
+
89
+ </div>
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ <h2>
100
+ Instance Method Summary
101
+ <small><a href="#" class="summary_toggle">collapse</a></small>
102
+ </h2>
103
+
104
+ <ul class="summary">
105
+
106
+ <li class="public ">
107
+ <span class="summary_signature">
108
+
109
+ <a href="#count_by-instance_method" title="#count_by (instance method)">#<strong>count_by</strong>(targets, &amp;fn) &#x21d2; Hash[Any, Integer] </a>
110
+
111
+
112
+
113
+ </span>
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <span class="summary_desc"><div class='inline'><p>Counts by a function.</p>
124
+ </div></span>
125
+
126
+ </li>
127
+
128
+
129
+ <li class="public ">
130
+ <span class="summary_signature">
131
+
132
+ <a href="#dig-instance_method" title="#dig (instance method)">#<strong>dig</strong>(path_map, expected_value) &#x21d2; Proc </a>
133
+
134
+
135
+
136
+ </span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'><p>A curried variant of Hash#dig meant to be passed as a matcher util.</p>
147
+ </div></span>
148
+
149
+ </li>
150
+
151
+
152
+ </ul>
153
+
154
+
155
+
156
+
157
+ <div id="instance_method_details" class="method_details_list">
158
+ <h2>Instance Method Details</h2>
159
+
160
+
161
+ <div class="method_details first">
162
+ <h3 class="signature first" id="count_by-instance_method">
163
+
164
+ #<strong>count_by</strong>(targets, &amp;fn) &#x21d2; <tt>Hash[Any, Integer]</tt>
165
+
166
+
167
+
168
+
169
+
170
+ </h3><div class="docstring">
171
+ <div class="discussion">
172
+ <p>Counts by a function. This is entirely because I hackney this everywhere in
173
+ pry anyways, so I want a function to do it for me already.</p>
174
+
175
+
176
+ </div>
177
+ </div>
178
+ <div class="tags">
179
+ <p class="tag_title">Parameters:</p>
180
+ <ul class="param">
181
+
182
+ <li>
183
+
184
+ <span class='name'>targets</span>
185
+
186
+
187
+ <span class='type'>(<tt>Array[Any]</tt>)</span>
188
+
189
+
190
+
191
+ &mdash;
192
+ <div class='inline'><p>Targets to count</p>
193
+ </div>
194
+
195
+ </li>
196
+
197
+ <li>
198
+
199
+ <span class='name'>&amp;fn</span>
200
+
201
+
202
+ <span class='type'>(<tt>Proc</tt>)</span>
203
+
204
+
205
+
206
+ &mdash;
207
+ <div class='inline'><p>Function to define count key</p>
208
+ </div>
209
+
210
+ </li>
211
+
212
+ </ul>
213
+
214
+ <p class="tag_title">Returns:</p>
215
+ <ul class="return">
216
+
217
+ <li>
218
+
219
+
220
+ <span class='type'>(<tt>Hash[Any, Integer]</tt>)</span>
221
+
222
+
223
+
224
+ &mdash;
225
+ <div class='inline'><p>Counts</p>
226
+ </div>
227
+
228
+ </li>
229
+
230
+ </ul>
231
+
232
+ </div><table class="source_code">
233
+ <tr>
234
+ <td>
235
+ <pre class="lines">
236
+
237
+
238
+ 29
239
+ 30
240
+ 31
241
+ 32
242
+ 33
243
+ 34
244
+ 35</pre>
245
+ </td>
246
+ <td>
247
+ <pre class="code"><span class="info file"># File 'lib/qo/helpers.rb', line 29</span>
248
+
249
+ <span class='kw'>def</span> <span class='id identifier rubyid_count_by'>count_by</span><span class='lparen'>(</span><span class='id identifier rubyid_targets'>targets</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_fn'>fn</span><span class='rparen'>)</span>
250
+ <span class='id identifier rubyid_fn'>fn</span> <span class='op'>||=</span> <span class='tlambda'>-&gt;</span> <span class='id identifier rubyid_v'>v</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_v'>v</span> <span class='rbrace'>}</span>
251
+
252
+ <span class='id identifier rubyid_targets'>targets</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_counts'>counts</span><span class='op'>|</span>
253
+ <span class='id identifier rubyid_counts'>counts</span><span class='lbracket'>[</span><span class='id identifier rubyid_fn'>fn</span><span class='lbracket'>[</span><span class='id identifier rubyid_target'>target</span><span class='rbracket'>]</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='int'>1</span>
254
+ <span class='rbrace'>}</span>
255
+ <span class='kw'>end</span></pre>
256
+ </td>
257
+ </tr>
258
+ </table>
259
+ </div>
260
+
261
+ <div class="method_details ">
262
+ <h3 class="signature " id="dig-instance_method">
263
+
264
+ #<strong>dig</strong>(path_map, expected_value) &#x21d2; <tt>Proc</tt>
265
+
266
+
267
+
268
+
269
+
270
+ </h3><div class="docstring">
271
+ <div class="discussion">
272
+
273
+ <div class="note notetag">
274
+ <strong>Note:</strong>
275
+ <div class='inline'><p>This method will attempt to coerce path segments to Symbols
276
+ if unsuccessful in first dig.</p>
277
+ </div>
278
+ </div>
279
+
280
+ <p>A curried variant of Hash#dig meant to be passed as a matcher util.</p>
281
+
282
+
283
+ </div>
284
+ </div>
285
+ <div class="tags">
286
+ <p class="tag_title">Parameters:</p>
287
+ <ul class="param">
288
+
289
+ <li>
290
+
291
+ <span class='name'>path_map</span>
292
+
293
+
294
+ <span class='type'>(<tt>String</tt>)</span>
295
+
296
+
297
+
298
+ &mdash;
299
+ <div class='inline'><p>Dot-delimited path</p>
300
+ </div>
301
+
302
+ </li>
303
+
304
+ <li>
305
+
306
+ <span class='name'>expected_value</span>
307
+
308
+
309
+ <span class='type'>(<tt>Any</tt>)</span>
310
+
311
+
312
+
313
+ &mdash;
314
+ <div class='inline'><p>Matcher</p>
315
+ </div>
316
+
317
+ </li>
318
+
319
+ </ul>
320
+
321
+ <p class="tag_title">Returns:</p>
322
+ <ul class="return">
323
+
324
+ <li>
325
+
326
+
327
+ <span class='type'>(<tt>Proc</tt>)</span>
328
+
329
+
330
+
331
+ &mdash;
332
+ <div class='inline'><p>Hash -&gt; Bool # Status of digging against the hash</p>
333
+ </div>
334
+
335
+ </li>
336
+
337
+ </ul>
338
+
339
+ </div><table class="source_code">
340
+ <tr>
341
+ <td>
342
+ <pre class="lines">
343
+
344
+
345
+ 13
346
+ 14
347
+ 15
348
+ 16
349
+ 17
350
+ 18
351
+ 19
352
+ 20</pre>
353
+ </td>
354
+ <td>
355
+ <pre class="code"><span class="info file"># File 'lib/qo/helpers.rb', line 13</span>
356
+
357
+ <span class='kw'>def</span> <span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='id identifier rubyid_path_map'>path_map</span><span class='comma'>,</span> <span class='id identifier rubyid_expected_value'>expected_value</span><span class='rparen'>)</span>
358
+ <span class='const'>Proc</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
359
+ <span class='id identifier rubyid_segments'>segments</span> <span class='op'>=</span> <span class='id identifier rubyid_path_map'>path_map</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>.</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
360
+
361
+ <span class='id identifier rubyid_expected_value'>expected_value</span> <span class='op'>===</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_segments'>segments</span><span class='rparen'>)</span> <span class='op'>||</span>
362
+ <span class='id identifier rubyid_expected_value'>expected_value</span> <span class='op'>===</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_segments'>segments</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_sym</span><span class='rparen'>)</span><span class='rparen'>)</span>
363
+ <span class='rbrace'>}</span>
364
+ <span class='kw'>end</span></pre>
365
+ </td>
366
+ </tr>
367
+ </table>
368
+ </div>
369
+
370
+ </div>
371
+
372
+ </div>
373
+
374
+ <div id="footer">
375
+ Generated on Sun Apr 15 20:29:44 2018 by
376
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
377
+ 0.9.12 (ruby-2.4.4).
378
+ </div>
379
+
380
+ </div>
381
+ </body>
382
+ </html>