qo 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -247,9 +247,9 @@
247
247
  </div>
248
248
 
249
249
  <div id="footer">
250
- Generated on Sun Apr 15 20:29:44 2018 by
250
+ Generated on Sun Aug 5 20:52:10 2018 by
251
251
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
252
- 0.9.12 (ruby-2.4.4).
252
+ 0.9.12 (ruby-2.5.1).
253
253
  </div>
254
254
 
255
255
  </div>
@@ -247,9 +247,9 @@
247
247
  </div>
248
248
 
249
249
  <div id="footer">
250
- Generated on Sun Apr 15 20:29:44 2018 by
250
+ Generated on Sun Aug 5 20:52:10 2018 by
251
251
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
252
- 0.9.12 (ruby-2.4.4).
252
+ 0.9.12 (ruby-2.5.1).
253
253
  </div>
254
254
 
255
255
  </div>
@@ -250,9 +250,9 @@ GuardBlockMatchers.</p>
250
250
  </div>
251
251
 
252
252
  <div id="footer">
253
- Generated on Sun Apr 15 20:29:44 2018 by
253
+ Generated on Sun Aug 5 20:52:10 2018 by
254
254
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
255
- 0.9.12 (ruby-2.4.4).
255
+ 0.9.12 (ruby-2.5.1).
256
256
  </div>
257
257
 
258
258
  </div>
data/docs/Qo/Helpers.html CHANGED
@@ -372,9 +372,9 @@ if unsuccessful in first dig.</p>
372
372
  </div>
373
373
 
374
374
  <div id="footer">
375
- Generated on Sun Apr 15 20:29:44 2018 by
375
+ Generated on Sun Aug 5 20:52:09 2018 by
376
376
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
377
- 0.9.12 (ruby-2.4.4).
377
+ 0.9.12 (ruby-2.5.1).
378
378
  </div>
379
379
 
380
380
  </div>
@@ -79,7 +79,7 @@
79
79
  <dl>
80
80
  <dt>Defined in:</dt>
81
81
  <dd>lib/qo/matchers/base_matcher.rb<span class="defines">,<br />
82
- lib/qo/matchers/hash_matcher.rb,<br /> lib/qo/matchers/array_matcher.rb,<br /> lib/qo/matchers/pattern_match.rb,<br /> lib/qo/matchers/guard_block_matcher.rb</span>
82
+ lib/qo/matchers/hash_matcher.rb,<br /> lib/qo/matchers/array_matcher.rb,<br /> lib/qo/matchers/pattern_match.rb,<br /> lib/qo/matchers/guard_block_matcher.rb,<br /> lib/qo/matchers/pattern_match_block.rb</span>
83
83
  </dd>
84
84
  </dl>
85
85
 
@@ -143,7 +143,7 @@ utilization of <code>super</code> as noted in <code>GuardBlockMatcher</code>.</p
143
143
 
144
144
 
145
145
 
146
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Matchers/ArrayMatcher.html" title="Qo::Matchers::ArrayMatcher (class)">ArrayMatcher</a></span>, <span class='object_link'><a href="Matchers/BaseMatcher.html" title="Qo::Matchers::BaseMatcher (class)">BaseMatcher</a></span>, <span class='object_link'><a href="Matchers/GuardBlockMatcher.html" title="Qo::Matchers::GuardBlockMatcher (class)">GuardBlockMatcher</a></span>, <span class='object_link'><a href="Matchers/HashMatcher.html" title="Qo::Matchers::HashMatcher (class)">HashMatcher</a></span>, <span class='object_link'><a href="Matchers/PatternMatch.html" title="Qo::Matchers::PatternMatch (class)">PatternMatch</a></span>
146
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Matchers/ArrayMatcher.html" title="Qo::Matchers::ArrayMatcher (class)">ArrayMatcher</a></span>, <span class='object_link'><a href="Matchers/BaseMatcher.html" title="Qo::Matchers::BaseMatcher (class)">BaseMatcher</a></span>, <span class='object_link'><a href="Matchers/GuardBlockMatcher.html" title="Qo::Matchers::GuardBlockMatcher (class)">GuardBlockMatcher</a></span>, <span class='object_link'><a href="Matchers/HashMatcher.html" title="Qo::Matchers::HashMatcher (class)">HashMatcher</a></span>, <span class='object_link'><a href="Matchers/PatternMatch.html" title="Qo::Matchers::PatternMatch (class)">PatternMatch</a></span>, <span class='object_link'><a href="Matchers/PatternMatchBlock.html" title="Qo::Matchers::PatternMatchBlock (class)">PatternMatchBlock</a></span>
147
147
 
148
148
 
149
149
  </p>
@@ -159,9 +159,9 @@ utilization of <code>super</code> as noted in <code>GuardBlockMatcher</code>.</p
159
159
  </div>
160
160
 
161
161
  <div id="footer">
162
- Generated on Sun Apr 15 20:29:44 2018 by
162
+ Generated on Sun Aug 5 20:52:10 2018 by
163
163
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
164
- 0.9.12 (ruby-2.4.4).
164
+ 0.9.12 (ruby-2.5.1).
165
165
  </div>
166
166
 
167
167
  </div>
@@ -449,9 +449,9 @@ such as:</p>
449
449
  </div>
450
450
 
451
451
  <div id="footer">
452
- Generated on Sun Apr 15 20:29:44 2018 by
452
+ Generated on Sun Aug 5 20:52:10 2018 by
453
453
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
454
- 0.9.12 (ruby-2.4.4).
454
+ 0.9.12 (ruby-2.5.1).
455
455
  </div>
456
456
 
457
457
  </div>
@@ -483,9 +483,9 @@ using one of call, ===, or []</p>
483
483
  </div>
484
484
 
485
485
  <div id="footer">
486
- Generated on Sun Apr 15 20:29:44 2018 by
486
+ Generated on Sun Aug 5 20:52:10 2018 by
487
487
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
488
- 0.9.12 (ruby-2.4.4).
488
+ 0.9.12 (ruby-2.5.1).
489
489
  </div>
490
490
 
491
491
  </div>
@@ -461,9 +461,9 @@ matcher would have passed</p>
461
461
  </div>
462
462
 
463
463
  <div id="footer">
464
- Generated on Sun Apr 15 20:29:44 2018 by
464
+ Generated on Sun Aug 5 20:52:10 2018 by
465
465
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
466
- 0.9.12 (ruby-2.4.4).
466
+ 0.9.12 (ruby-2.5.1).
467
467
  </div>
468
468
 
469
469
  </div>
@@ -435,9 +435,9 @@ such as:</p>
435
435
  </div>
436
436
 
437
437
  <div id="footer">
438
- Generated on Sun Apr 15 20:29:44 2018 by
438
+ Generated on Sun Aug 5 20:52:10 2018 by
439
439
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
440
- 0.9.12 (ruby-2.4.4).
440
+ 0.9.12 (ruby-2.5.1).
441
441
  </div>
442
442
 
443
443
  </div>
@@ -541,9 +541,9 @@ but for now the associated performance penalty may be too steep to consider.</p>
541
541
  </div>
542
542
 
543
543
  <div id="footer">
544
- Generated on Sun Apr 15 20:29:44 2018 by
544
+ Generated on Sun Aug 5 20:52:10 2018 by
545
545
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
546
- 0.9.12 (ruby-2.4.4).
546
+ 0.9.12 (ruby-2.5.1).
547
547
  </div>
548
548
 
549
549
  </div>
@@ -0,0 +1,832 @@
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: Qo::Matchers::PatternMatchBlock
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::Matchers::PatternMatchBlock";
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 (P)</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="../Matchers.html" title="Qo::Matchers (module)">Matchers</a></span></span>
41
+ &raquo;
42
+ <span class="title">PatternMatchBlock</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: Qo::Matchers::PatternMatchBlock
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">Qo::Matchers::PatternMatchBlock</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/qo/matchers/pattern_match_block.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p>Creates a PatternMatch in the style of a block.</p>
105
+
106
+ <p>This varies from the regular PatternMatch in that all matchers are
107
+ provided in a more succinct block format:</p>
108
+
109
+ <pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="../../Qo.html" title="Qo (module)">Qo</a></span></span><span class='period'>.</span><span class='id identifier rubyid_match'><span class='object_link'><a href="../PublicApi.html#match-instance_method" title="Qo::PublicApi#match (method)">match</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_m'>m</span><span class='op'>|</span>
110
+ <span class='id identifier rubyid_m'>m</span><span class='period'>.</span><span class='id identifier rubyid_when'>when</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^F</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='int'>42</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_age'>age</span><span class='rparen'>)</span><span class='op'>|</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> is </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_age'>age</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
111
+ <span class='id identifier rubyid_m'>m</span><span class='period'>.</span><span class='id identifier rubyid_else'>else</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>We need a default, right?</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
112
+ <span class='rbrace'>}</span>
113
+ </code></pre>
114
+
115
+ <p>The Public API obscures the fact that the matcher is only called when it
116
+ is explicitly given an argument to match against. If it is not, it will
117
+ just return a class waiting for a target, as such:</p>
118
+
119
+ <pre class="code ruby"><code class="ruby"><span class='kw'>def</span> <span class='id identifier rubyid_get_url'>get_url</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
120
+ <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_get_response'>get_response</span><span class='lparen'>(</span><span class='const'>URI</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_yield_self'>yield_self</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='const'><span class='object_link'><a href="../../Qo.html" title="Qo (module)">Qo</a></span></span><span class='period'>.</span><span class='id identifier rubyid_match'><span class='object_link'><a href="../PublicApi.html#match-instance_method" title="Qo::PublicApi#match (method)">match</a></span></span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_m'>m</span><span class='op'>|</span>
121
+ <span class='id identifier rubyid_m'>m</span><span class='period'>.</span><span class='id identifier rubyid_when'>when</span><span class='lparen'>(</span><span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTPSuccess</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_response'>response</span><span class='op'>|</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='rbrace'>}</span>
122
+ <span class='id identifier rubyid_m'>m</span><span class='period'>.</span><span class='id identifier rubyid_else'>else</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_response'>response</span><span class='op'>|</span> <span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='rbrace'>}</span>
123
+ <span class='rbrace'>}</span><span class='rparen'>)</span>
124
+ <span class='kw'>end</span>
125
+
126
+ <span class='id identifier rubyid_get_url'>get_url</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>https://github.com/baweaver/qo</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
127
+ <span class='comment'># =&gt; 142387
128
+ </span><span class='id identifier rubyid_get_url'>get_url</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>https://github.com/baweaver/qo/does_not_exist</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
129
+ <span class='comment'># =&gt; RuntimeError: Not Found
130
+ </span></code></pre>
131
+
132
+ <p>This is intended for flexibility between singular calls and calls as a
133
+ paramater to higher order functions like <code>map</code> and <code>yield_self</code>.</p>
134
+
135
+ <p>This variant was inspired by ideas from Scala, Haskell, and various Ruby
136
+ libraries dealing with Async and self-yielding blocks. Especially notable
137
+ were websocket handlers and dry-ruby implementations.</p>
138
+
139
+
140
+ </div>
141
+ </div>
142
+ <div class="tags">
143
+
144
+ <p class="tag_title">Author:</p>
145
+ <ul class="author">
146
+
147
+ <li>
148
+
149
+
150
+
151
+
152
+
153
+ <div class='inline'><p>baweaver</p>
154
+ </div>
155
+
156
+ </li>
157
+
158
+ </ul>
159
+ <p class="tag_title">Since:</p>
160
+ <ul class="since">
161
+
162
+ <li>
163
+
164
+
165
+
166
+
167
+
168
+ <div class='inline'><p>0.3.0</p>
169
+ </div>
170
+
171
+ </li>
172
+
173
+ </ul>
174
+
175
+ </div>
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+ <h2>
184
+ Instance Method Summary
185
+ <small><a href="#" class="summary_toggle">collapse</a></small>
186
+ </h2>
187
+
188
+ <ul class="summary">
189
+
190
+ <li class="public ">
191
+ <span class="summary_signature">
192
+
193
+ <a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong>(target) &#x21d2; Any | nil </a>
194
+
195
+
196
+
197
+ </span>
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+ <span class="summary_desc"><div class='inline'><p>Immediately invokes a PatternMatch.</p>
208
+ </div></span>
209
+
210
+ </li>
211
+
212
+
213
+ <li class="public ">
214
+ <span class="summary_signature">
215
+
216
+ <a href="#else-instance_method" title="#else (instance method)">#<strong>else</strong>(&amp;fn) &#x21d2; Proc </a>
217
+
218
+
219
+
220
+ </span>
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+ <span class="summary_desc"><div class='inline'><p>Else is the last statement that will be evaluated if all other parts fail.</p>
231
+ </div></span>
232
+
233
+ </li>
234
+
235
+
236
+ <li class="public ">
237
+ <span class="summary_signature">
238
+
239
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> {|_self| ... } &#x21d2; PatternMatchBlock </a>
240
+
241
+
242
+
243
+ </span>
244
+
245
+
246
+ <span class="note title constructor">constructor</span>
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+ <span class="summary_desc"><div class='inline'><p>A new instance of PatternMatchBlock.</p>
256
+ </div></span>
257
+
258
+ </li>
259
+
260
+
261
+ <li class="public ">
262
+ <span class="summary_signature">
263
+
264
+ <a href="#to_proc-instance_method" title="#to_proc (instance method)">#<strong>to_proc</strong> &#x21d2; Proc </a>
265
+
266
+
267
+
268
+ </span>
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+ <span class="summary_desc"><div class='inline'><p>Proc version of a PatternMatchBlock.</p>
279
+ </div></span>
280
+
281
+ </li>
282
+
283
+
284
+ <li class="public ">
285
+ <span class="summary_signature">
286
+
287
+ <a href="#when-instance_method" title="#when (instance method)">#<strong>when</strong>(*array_matchers, **keyword_matchers, &amp;fn) &#x21d2; Array[GuardBlockMatcher] </a>
288
+
289
+
290
+
291
+ </span>
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+ <span class="summary_desc"><div class='inline'><p>Creates a match case.</p>
302
+ </div></span>
303
+
304
+ </li>
305
+
306
+
307
+ </ul>
308
+
309
+
310
+ <div id="constructor_details" class="method_details_list">
311
+ <h2>Constructor Details</h2>
312
+
313
+ <div class="method_details first">
314
+ <h3 class="signature first" id="initialize-instance_method">
315
+
316
+ #<strong>initialize</strong> {|_self| ... } &#x21d2; <tt><span class='object_link'><a href="" title="Qo::Matchers::PatternMatchBlock (class)">PatternMatchBlock</a></span></tt>
317
+
318
+
319
+
320
+
321
+
322
+ </h3><div class="docstring">
323
+ <div class="discussion">
324
+ <p>Returns a new instance of PatternMatchBlock</p>
325
+
326
+
327
+ </div>
328
+ </div>
329
+ <div class="tags">
330
+
331
+ <p class="tag_title">Yields:</p>
332
+ <ul class="yield">
333
+
334
+ <li>
335
+
336
+
337
+ <span class='type'>(<tt>_self</tt>)</span>
338
+
339
+
340
+
341
+ </li>
342
+
343
+ </ul>
344
+ <p class="tag_title">Yield Parameters:</p>
345
+ <ul class="yieldparam">
346
+
347
+ <li>
348
+
349
+ <span class='name'>_self</span>
350
+
351
+
352
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Qo::Matchers::PatternMatchBlock (class)">Qo::Matchers::PatternMatchBlock</a></span></tt>)</span>
353
+
354
+
355
+
356
+ &mdash;
357
+ <div class='inline'><p>the object that the method was called on</p>
358
+ </div>
359
+
360
+ </li>
361
+
362
+ </ul>
363
+ <p class="tag_title">Since:</p>
364
+ <ul class="since">
365
+
366
+ <li>
367
+
368
+
369
+
370
+
371
+
372
+ <div class='inline'><p>0.3.0</p>
373
+ </div>
374
+
375
+ </li>
376
+
377
+ </ul>
378
+
379
+ </div><table class="source_code">
380
+ <tr>
381
+ <td>
382
+ <pre class="lines">
383
+
384
+
385
+ 46
386
+ 47
387
+ 48
388
+ 49
389
+ 50</pre>
390
+ </td>
391
+ <td>
392
+ <pre class="code"><span class="info file"># File 'lib/qo/matchers/pattern_match_block.rb', line 46</span>
393
+
394
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
395
+ <span class='ivar'>@matchers</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
396
+
397
+ <span class='kw'>yield</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
398
+ <span class='kw'>end</span></pre>
399
+ </td>
400
+ </tr>
401
+ </table>
402
+ </div>
403
+
404
+ </div>
405
+
406
+
407
+ <div id="instance_method_details" class="method_details_list">
408
+ <h2>Instance Method Details</h2>
409
+
410
+
411
+ <div class="method_details first">
412
+ <h3 class="signature first" id="call-instance_method">
413
+
414
+ #<strong>call</strong>(target) &#x21d2; <tt>Any | nil</tt>
415
+
416
+
417
+
418
+
419
+
420
+ </h3><div class="docstring">
421
+ <div class="discussion">
422
+ <p>Immediately invokes a PatternMatch</p>
423
+
424
+
425
+ </div>
426
+ </div>
427
+ <div class="tags">
428
+ <p class="tag_title">Parameters:</p>
429
+ <ul class="param">
430
+
431
+ <li>
432
+
433
+ <span class='name'>target</span>
434
+
435
+
436
+ <span class='type'>(<tt>Any</tt>)</span>
437
+
438
+
439
+
440
+ &mdash;
441
+ <div class='inline'><p>Target to run against and pipe to the associated block if it
442
+ &quot;matches&quot; any of the GuardBlocks</p>
443
+ </div>
444
+
445
+ </li>
446
+
447
+ </ul>
448
+
449
+ <p class="tag_title">Returns:</p>
450
+ <ul class="return">
451
+
452
+ <li>
453
+
454
+
455
+ <span class='type'>(<tt>Any | nil</tt>)</span>
456
+
457
+
458
+
459
+ &mdash;
460
+ <div class='inline'><p>Result of the piped block, or nil on a miss</p>
461
+ </div>
462
+
463
+ </li>
464
+
465
+ </ul>
466
+ <p class="tag_title">Since:</p>
467
+ <ul class="since">
468
+
469
+ <li>
470
+
471
+
472
+
473
+
474
+
475
+ <div class='inline'><p>0.3.0</p>
476
+ </div>
477
+
478
+ </li>
479
+
480
+ </ul>
481
+
482
+ </div><table class="source_code">
483
+ <tr>
484
+ <td>
485
+ <pre class="lines">
486
+
487
+
488
+ 103
489
+ 104
490
+ 105
491
+ 106
492
+ 107
493
+ 108
494
+ 109
495
+ 110
496
+ 111
497
+ 112</pre>
498
+ </td>
499
+ <td>
500
+ <pre class="code"><span class="info file"># File 'lib/qo/matchers/pattern_match_block.rb', line 103</span>
501
+
502
+ <span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
503
+ <span class='ivar'>@matchers</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_guard_block_matcher'>guard_block_matcher</span><span class='op'>|</span>
504
+ <span class='id identifier rubyid_did_match'>did_match</span><span class='comma'>,</span> <span class='id identifier rubyid_match_result'>match_result</span> <span class='op'>=</span> <span class='id identifier rubyid_guard_block_matcher'>guard_block_matcher</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
505
+ <span class='kw'>return</span> <span class='id identifier rubyid_match_result'>match_result</span> <span class='kw'>if</span> <span class='id identifier rubyid_did_match'>did_match</span>
506
+ <span class='rbrace'>}</span>
507
+
508
+ <span class='kw'>return</span> <span class='ivar'>@else</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@else</span>
509
+
510
+ <span class='kw'>nil</span>
511
+ <span class='kw'>end</span></pre>
512
+ </td>
513
+ </tr>
514
+ </table>
515
+ </div>
516
+
517
+ <div class="method_details ">
518
+ <h3 class="signature " id="else-instance_method">
519
+
520
+ #<strong>else</strong>(&amp;fn) &#x21d2; <tt>Proc</tt>
521
+
522
+
523
+
524
+
525
+
526
+ </h3><div class="docstring">
527
+ <div class="discussion">
528
+ <p>Else is the last statement that will be evaluated if all other parts
529
+ fail. It should be noted that it won&#39;t magically appear, you have to
530
+ explicitly put an <code>else</code> case in for it to catch on no match unless
531
+ you want a <code>nil</code> return</p>
532
+
533
+
534
+ </div>
535
+ </div>
536
+ <div class="tags">
537
+ <p class="tag_title">Parameters:</p>
538
+ <ul class="param">
539
+
540
+ <li>
541
+
542
+ <span class='name'>&amp;fn</span>
543
+
544
+
545
+ <span class='type'>(<tt>Proc</tt>)</span>
546
+
547
+
548
+
549
+ &mdash;
550
+ <div class='inline'><p>Function to call when all other matches have failed</p>
551
+ </div>
552
+
553
+ </li>
554
+
555
+ </ul>
556
+
557
+ <p class="tag_title">Returns:</p>
558
+ <ul class="return">
559
+
560
+ <li>
561
+
562
+
563
+ <span class='type'>(<tt>Proc</tt>)</span>
564
+
565
+
566
+
567
+ </li>
568
+
569
+ </ul>
570
+ <p class="tag_title">Raises:</p>
571
+ <ul class="raise">
572
+
573
+ <li>
574
+
575
+
576
+ <span class='type'>(<tt><span class='object_link'><a href="../Exceptions/MultipleElseClauses.html" title="Qo::Exceptions::MultipleElseClauses (class)">Qo::Exceptions::MultipleElseClauses</a></span></tt>)</span>
577
+
578
+
579
+
580
+ </li>
581
+
582
+ </ul>
583
+ <p class="tag_title">Since:</p>
584
+ <ul class="since">
585
+
586
+ <li>
587
+
588
+
589
+
590
+
591
+
592
+ <div class='inline'><p>0.3.0</p>
593
+ </div>
594
+
595
+ </li>
596
+
597
+ </ul>
598
+
599
+ </div><table class="source_code">
600
+ <tr>
601
+ <td>
602
+ <pre class="lines">
603
+
604
+
605
+ 83
606
+ 84
607
+ 85
608
+ 86</pre>
609
+ </td>
610
+ <td>
611
+ <pre class="code"><span class="info file"># File 'lib/qo/matchers/pattern_match_block.rb', line 83</span>
612
+
613
+ <span class='kw'>def</span> <span class='kw'>else</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_fn'>fn</span><span class='rparen'>)</span>
614
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../Qo.html" title="Qo (module)">Qo</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exceptions.html" title="Qo::Exceptions (module)">Exceptions</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Exceptions/MultipleElseClauses.html" title="Qo::Exceptions::MultipleElseClauses (class)">MultipleElseClauses</a></span></span> <span class='kw'>if</span> <span class='ivar'>@else</span>
615
+ <span class='ivar'>@else</span> <span class='op'>=</span> <span class='id identifier rubyid_fn'>fn</span>
616
+ <span class='kw'>end</span></pre>
617
+ </td>
618
+ </tr>
619
+ </table>
620
+ </div>
621
+
622
+ <div class="method_details ">
623
+ <h3 class="signature " id="to_proc-instance_method">
624
+
625
+ #<strong>to_proc</strong> &#x21d2; <tt>Proc</tt>
626
+
627
+
628
+
629
+
630
+
631
+ </h3><div class="docstring">
632
+ <div class="discussion">
633
+ <p>Proc version of a PatternMatchBlock</p>
634
+
635
+
636
+ </div>
637
+ </div>
638
+ <div class="tags">
639
+
640
+ <p class="tag_title">Returns:</p>
641
+ <ul class="return">
642
+
643
+ <li>
644
+
645
+
646
+ <span class='type'>(<tt>Proc</tt>)</span>
647
+
648
+
649
+
650
+ &mdash;
651
+ <div class='inline'><p>Any -&gt; Any | nil</p>
652
+ </div>
653
+
654
+ </li>
655
+
656
+ </ul>
657
+ <p class="tag_title">Since:</p>
658
+ <ul class="since">
659
+
660
+ <li>
661
+
662
+
663
+
664
+
665
+
666
+ <div class='inline'><p>0.3.0</p>
667
+ </div>
668
+
669
+ </li>
670
+
671
+ </ul>
672
+
673
+ </div><table class="source_code">
674
+ <tr>
675
+ <td>
676
+ <pre class="lines">
677
+
678
+
679
+ 92
680
+ 93
681
+ 94</pre>
682
+ </td>
683
+ <td>
684
+ <pre class="code"><span class="info file"># File 'lib/qo/matchers/pattern_match_block.rb', line 92</span>
685
+
686
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_proc'>to_proc</span>
687
+ <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_target'>target</span><span class='op'>|</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
688
+ <span class='kw'>end</span></pre>
689
+ </td>
690
+ </tr>
691
+ </table>
692
+ </div>
693
+
694
+ <div class="method_details ">
695
+ <h3 class="signature " id="when-instance_method">
696
+
697
+ #<strong>when</strong>(*array_matchers, **keyword_matchers, &amp;fn) &#x21d2; <tt>Array[<span class='object_link'><a href="GuardBlockMatcher.html" title="Qo::Matchers::GuardBlockMatcher (class)">GuardBlockMatcher</a></span>]</tt>
698
+
699
+
700
+
701
+
702
+
703
+ </h3><div class="docstring">
704
+ <div class="discussion">
705
+ <p>Creates a match case. This is the exact same as any other <code>and</code> style
706
+ match reflected in the public API, except that it&#39;s a Guard Block
707
+ match being performed. That means if the left side matches, the right
708
+ side function is invoked and that value is returned.</p>
709
+
710
+
711
+ </div>
712
+ </div>
713
+ <div class="tags">
714
+ <p class="tag_title">Parameters:</p>
715
+ <ul class="param">
716
+
717
+ <li>
718
+
719
+ <span class='name'>*array_matchers</span>
720
+
721
+
722
+ <span class='type'>(<tt>Array[Any]</tt>)</span>
723
+
724
+
725
+
726
+ &mdash;
727
+ <div class='inline'><p>Array style matchers</p>
728
+ </div>
729
+
730
+ </li>
731
+
732
+ <li>
733
+
734
+ <span class='name'>**keyword_matchers</span>
735
+
736
+
737
+ <span class='type'>(<tt>Hash[Any, Any]</tt>)</span>
738
+
739
+
740
+
741
+ &mdash;
742
+ <div class='inline'><p>Hash style matchers</p>
743
+ </div>
744
+
745
+ </li>
746
+
747
+ <li>
748
+
749
+ <span class='name'>&amp;fn</span>
750
+
751
+
752
+ <span class='type'>(<tt>Proc</tt>)</span>
753
+
754
+
755
+
756
+ &mdash;
757
+ <div class='inline'><p>If matched, this function will be called</p>
758
+ </div>
759
+
760
+ </li>
761
+
762
+ </ul>
763
+
764
+ <p class="tag_title">Returns:</p>
765
+ <ul class="return">
766
+
767
+ <li>
768
+
769
+
770
+ <span class='type'>(<tt>Array[<span class='object_link'><a href="GuardBlockMatcher.html" title="Qo::Matchers::GuardBlockMatcher (class)">GuardBlockMatcher</a></span>]</tt>)</span>
771
+
772
+
773
+
774
+ &mdash;
775
+ <div class='inline'><p>The return of this method should not be directly depended on, but will
776
+ provide all matchers currently present. This will likely be left for
777
+ ease of debugging later.</p>
778
+ </div>
779
+
780
+ </li>
781
+
782
+ </ul>
783
+ <p class="tag_title">Since:</p>
784
+ <ul class="since">
785
+
786
+ <li>
787
+
788
+
789
+
790
+
791
+
792
+ <div class='inline'><p>0.3.0</p>
793
+ </div>
794
+
795
+ </li>
796
+
797
+ </ul>
798
+
799
+ </div><table class="source_code">
800
+ <tr>
801
+ <td>
802
+ <pre class="lines">
803
+
804
+
805
+ 70
806
+ 71
807
+ 72</pre>
808
+ </td>
809
+ <td>
810
+ <pre class="code"><span class="info file"># File 'lib/qo/matchers/pattern_match_block.rb', line 70</span>
811
+
812
+ <span class='kw'>def</span> <span class='kw'>when</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_array_matchers'>array_matchers</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_keyword_matchers'>keyword_matchers</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_fn'>fn</span><span class='rparen'>)</span>
813
+ <span class='ivar'>@matchers</span> <span class='op'>&lt;&lt;</span> <span class='const'><span class='object_link'><a href="../../Qo.html" title="Qo (module)">Qo</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Matchers.html" title="Qo::Matchers (module)">Matchers</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GuardBlockMatcher.html" title="Qo::Matchers::GuardBlockMatcher (class)">GuardBlockMatcher</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="GuardBlockMatcher.html#initialize-instance_method" title="Qo::Matchers::GuardBlockMatcher#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_array_matchers'>array_matchers</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_keyword_matchers'>keyword_matchers</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_fn'>fn</span><span class='rparen'>)</span>
814
+ <span class='kw'>end</span></pre>
815
+ </td>
816
+ </tr>
817
+ </table>
818
+ </div>
819
+
820
+ </div>
821
+
822
+ </div>
823
+
824
+ <div id="footer">
825
+ Generated on Sun Aug 5 20:52:10 2018 by
826
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
827
+ 0.9.12 (ruby-2.5.1).
828
+ </div>
829
+
830
+ </div>
831
+ </body>
832
+ </html>