qo 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +40 -84
- data/docs/Qo.html +4 -9
- data/docs/Qo/Exceptions.html +3 -3
- data/docs/Qo/Exceptions/MultipleElseClauses.html +257 -0
- data/docs/Qo/Exceptions/MultipleMatchersProvided.html +2 -2
- data/docs/Qo/Exceptions/NoMatchersProvided.html +2 -2
- data/docs/Qo/Exceptions/NotAllGuardMatchersProvided.html +2 -2
- data/docs/Qo/Helpers.html +2 -2
- data/docs/Qo/Matchers.html +4 -4
- data/docs/Qo/Matchers/ArrayMatcher.html +2 -2
- data/docs/Qo/Matchers/BaseMatcher.html +2 -2
- data/docs/Qo/Matchers/GuardBlockMatcher.html +2 -2
- data/docs/Qo/Matchers/HashMatcher.html +2 -2
- data/docs/Qo/Matchers/PatternMatch.html +2 -2
- data/docs/Qo/Matchers/PatternMatchBlock.html +832 -0
- data/docs/Qo/PublicApi.html +77 -19
- data/docs/_index.html +16 -2
- data/docs/class_list.html +1 -1
- data/docs/file.README.html +92 -78
- data/docs/img/qo_logo.png +0 -0
- data/docs/img/whoa_lemur.png +0 -0
- data/docs/index.html +92 -78
- data/docs/method_list.html +77 -29
- data/docs/top-level-namespace.html +2 -2
- data/img/qo_logo.png +0 -0
- data/lib/qo.rb +3 -2
- data/lib/qo/matchers/array_matcher.rb +0 -1
- data/lib/qo/matchers/base_matcher.rb +0 -12
- data/lib/qo/matchers/hash_matcher.rb +0 -2
- data/lib/qo/version.rb +1 -1
- data/performance_report.txt +37 -37
- data/qo.gemspec +2 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dcdd32a9c1743ae07fee6699551ca57393c751ce8172950edea505013e5a628
|
4
|
+
data.tar.gz: 4b39a86b816b039c3282a5b0d307afb796f5dabed249cf3b658462a5bd791ece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb43a7e3a7e2134d477149548c1de8de6961fa62a8da1c606ffa743287d95cb05bd5d400174e343297cf9c21a205f32aa60500abbb32c094c1cac4699558f18f
|
7
|
+
data.tar.gz: 481c3331b0e1328b8e6eae0fd8c34ca54df0f58204cf8a0dc0cfff568343af618450a5978c1132e3a250da474c7dfd90fc4df3132ecc99f80095a1fc485b7faa
|
data/README.md
CHANGED
@@ -30,6 +30,9 @@ Fast forward a few months and I kind of wanted to make it real, so here it is. I
|
|
30
30
|
|
31
31
|
## Usage
|
32
32
|
|
33
|
+
Note that Qo uses the [Any](https://www.github.com/baweaver/any) gem for wildcard matching. Any will respond true to any `==` or `===` query against it,
|
34
|
+
and is included in the gem.
|
35
|
+
|
33
36
|
### Quick Start
|
34
37
|
|
35
38
|
Qo is used for pattern matching in Ruby. All Qo matchers respond to `===` and `to_proc` meaning they can be used with `case` and Enumerable functions alike:
|
@@ -37,7 +40,7 @@ Qo is used for pattern matching in Ruby. All Qo matchers respond to `===` and `t
|
|
37
40
|
|
38
41
|
```ruby
|
39
42
|
case ['Foo', 42]
|
40
|
-
when Qo[
|
43
|
+
when Qo[Any, 42] then 'Truly the one answer'
|
41
44
|
else nil
|
42
45
|
end
|
43
46
|
|
@@ -51,18 +54,18 @@ How about some pattern matching? There are two styles:
|
|
51
54
|
|
52
55
|
The original style
|
53
56
|
|
54
|
-
```
|
57
|
+
```ruby
|
55
58
|
# How about some "right-hand assignment" pattern matching
|
56
59
|
name_longer_than_three = -> person { person.name.size > 3 }
|
57
60
|
people_with_truncated_names = people.map(&Qo.match(
|
58
61
|
Qo.m(name_longer_than_three) { |person| Person.new(person.name[0..2], person.age) },
|
59
|
-
Qo.m(
|
62
|
+
Qo.m(Any) # Identity function, catch-all
|
60
63
|
))
|
61
64
|
|
62
65
|
# And standalone like a case:
|
63
66
|
Qo.match(people.first,
|
64
67
|
Qo.m(age: 10..19) { |person| "#{person.name} is a teen that's #{person.age} years old" },
|
65
|
-
Qo.m(
|
68
|
+
Qo.m(Any) { |person| "#{person.name} is #{person.age} years old" }
|
66
69
|
)
|
67
70
|
```
|
68
71
|
|
@@ -130,16 +133,16 @@ people_objects = [
|
|
130
133
|
|
131
134
|
### 1 - Wildcard Matching
|
132
135
|
|
133
|
-
Qo has a concept of a Wildcard,
|
136
|
+
Qo has a concept of a Wildcard, `Any`, which will match against any value
|
134
137
|
|
135
138
|
```ruby
|
136
|
-
Qo[
|
139
|
+
Qo[Any, Any] === ['Robert', 22] # true
|
137
140
|
```
|
138
141
|
|
139
142
|
A single wildcard will match anything, and can frequently be used as an always true:
|
140
143
|
|
141
144
|
```ruby
|
142
|
-
Qo[
|
145
|
+
Qo[Any] === :literally_anything_here
|
143
146
|
```
|
144
147
|
|
145
148
|
### 2 - Array Matching
|
@@ -156,63 +159,40 @@ This gives us the `and` matcher shorthand for array matchers.
|
|
156
159
|
|
157
160
|
When an Array matcher is run against an Array, it will compare elements by index in the following priority:
|
158
161
|
|
159
|
-
1.
|
160
|
-
2. Does it
|
161
|
-
3. Does it have a predicate method by that name that matches?
|
162
|
+
1. Does it case match (`===`)?
|
163
|
+
2. Does it have a predicate method by that name that matches?
|
162
164
|
|
163
165
|
This functionality is left biased and permissive, meaning that if the right side of the argument is longer it will ignore those items in the match. If it's shorter? Not so much.
|
164
166
|
|
165
|
-
##### 2.1.1 -
|
166
|
-
|
167
|
-
```ruby
|
168
|
-
# Standalone
|
169
|
-
|
170
|
-
Qo[:*, :*] === ['Robert', 22]
|
171
|
-
# => true
|
172
|
-
|
173
|
-
# Case statement
|
174
|
-
|
175
|
-
case ['Roberta', 22]
|
176
|
-
when Qo[:*, :*] then 'it matched'
|
177
|
-
else 'will not ever be reached'
|
178
|
-
end
|
179
|
-
# => 'it matched'
|
180
|
-
|
181
|
-
# Select
|
182
|
-
|
183
|
-
people_arrays.select(&Qo[:*, :*])
|
184
|
-
# => [['Robert', 22], ['Roberta', 22], ['Foo', 42], ['Bar', 18]]
|
185
|
-
```
|
186
|
-
|
187
|
-
##### 2.1.2 - Case Match present
|
167
|
+
##### 2.1.1 - Case Match present
|
188
168
|
|
189
169
|
We've seen some case matching so far with `Range` and `Regex`:
|
190
170
|
|
191
171
|
```ruby
|
192
172
|
# Standalone
|
193
173
|
|
194
|
-
Qo[/Rob/,
|
174
|
+
Qo[/Rob/, Any] === ['Robert', 22]
|
195
175
|
# => true
|
196
176
|
|
197
177
|
# Case statement
|
198
178
|
|
199
179
|
case ['Roberta', 22]
|
200
|
-
when Qo[
|
201
|
-
when Qo[
|
202
|
-
when Qo[
|
180
|
+
when Qo[Any, 0..9] then 'child'
|
181
|
+
when Qo[Any, 10..19] then 'teen'
|
182
|
+
when Qo[Any, 20..99] then 'adult'
|
203
183
|
else 'not sure'
|
204
184
|
end
|
205
185
|
# => 'adult'
|
206
186
|
|
207
187
|
# Select
|
208
188
|
|
209
|
-
people_arrays.select(&Qo[
|
189
|
+
people_arrays.select(&Qo[Any, 10..19])
|
210
190
|
# => [['Bar', 18]]
|
211
191
|
```
|
212
192
|
|
213
|
-
##### 2.1.
|
193
|
+
##### 2.1.2 - Predicate Method matched
|
214
194
|
|
215
|
-
If no
|
195
|
+
If no case match is found, it will attempt to see if a predicate method by the same name exists, call it, and check the result:
|
216
196
|
|
217
197
|
```ruby
|
218
198
|
dirty_values = [nil, '', true]
|
@@ -225,14 +205,14 @@ Qo[:nil?] === [nil]
|
|
225
205
|
# Case statement
|
226
206
|
|
227
207
|
case ['Roberta', nil]
|
228
|
-
when Qo[
|
208
|
+
when Qo[Any, :nil?] then 'no age'
|
229
209
|
else 'not sure'
|
230
210
|
end
|
231
211
|
# => 'no age'
|
232
212
|
|
233
213
|
# Select
|
234
214
|
|
235
|
-
people_arrays.select(&Qo[
|
215
|
+
people_arrays.select(&Qo[Any, :even?])
|
236
216
|
# => [["Robert", 22], ["Roberta", 22], ["Foo", 42], ["Bar", 18]]
|
237
217
|
```
|
238
218
|
|
@@ -240,21 +220,12 @@ people_arrays.select(&Qo[:*, :even?])
|
|
240
220
|
|
241
221
|
When an Array matcher is matched against anything other than an Array it will follow the priority:
|
242
222
|
|
243
|
-
1. Was a wildcard provided?
|
244
223
|
2. Does it case match (`===`)?
|
245
224
|
3. Does it have a predicate method by that name that matches?
|
246
225
|
|
247
226
|
Every argument provided will be run against the target object.
|
248
227
|
|
249
|
-
##### 2.2.1 -
|
250
|
-
|
251
|
-
A wildcard in an Array to Object match is functionally an always true, but can be used as such:
|
252
|
-
|
253
|
-
```ruby
|
254
|
-
Qo[:*] === :literally_anything_here
|
255
|
-
```
|
256
|
-
|
257
|
-
##### 2.2.2 - Case Match present
|
228
|
+
##### 2.2.1 - Case Match present
|
258
229
|
|
259
230
|
```ruby
|
260
231
|
# Standalone
|
@@ -270,7 +241,7 @@ Qo[Integer, 15..25] === 20
|
|
270
241
|
# => [10, "string"]
|
271
242
|
```
|
272
243
|
|
273
|
-
##### 2.2.
|
244
|
+
##### 2.2.2 - Predicate Method matched
|
274
245
|
|
275
246
|
Now this is where some of the fun starts in
|
276
247
|
|
@@ -302,10 +273,9 @@ end
|
|
302
273
|
|
303
274
|
1. Does the key exist on the other hash?
|
304
275
|
2. Are the match value and match target hashes?
|
305
|
-
3.
|
306
|
-
4. Does the target object's value
|
307
|
-
5.
|
308
|
-
6. What about the String version of the match key? Abort if it can't coerce.
|
276
|
+
3. Does the target object's value case match against the match value?
|
277
|
+
4. Does the target object's value predicate match against the match value?
|
278
|
+
5. What about the String version of the match key? Abort if it can't coerce.
|
309
279
|
|
310
280
|
##### 3.1.1 - Key present
|
311
281
|
|
@@ -352,16 +322,7 @@ Qo.or(a: {
|
|
352
322
|
})
|
353
323
|
```
|
354
324
|
|
355
|
-
##### 3.1.3 -
|
356
|
-
|
357
|
-
As with other wildcards, if the value matched against is a wildcard it'll always get through:
|
358
|
-
|
359
|
-
```ruby
|
360
|
-
Qo[name: :*] === {name: 'Foo'}
|
361
|
-
# => true
|
362
|
-
```
|
363
|
-
|
364
|
-
##### 3.1.4 - Case match present
|
325
|
+
##### 3.1.3 - Case match present
|
365
326
|
|
366
327
|
If a case match is present for the key, it'll try and compare:
|
367
328
|
|
@@ -386,7 +347,7 @@ people_hashes.select(&Qo[age: 15..25])
|
|
386
347
|
# => [{:name=>"Robert", :age=>22}, {:name=>"Roberta", :age=>22}, {:name=>"Bar", :age=>18}]
|
387
348
|
```
|
388
349
|
|
389
|
-
##### 3.1.
|
350
|
+
##### 3.1.4 - Predicate match present
|
390
351
|
|
391
352
|
Much like our array friend above, if a predicate style method is present see if it'll work
|
392
353
|
|
@@ -413,26 +374,21 @@ people_hashes.reject(&Qo[age: :nil?])
|
|
413
374
|
|
414
375
|
Careful though, if the key doesn't exist that won't match. I'll have to consider this one later.
|
415
376
|
|
416
|
-
##### 3.1.
|
377
|
+
##### 3.1.5 - String variant present
|
417
378
|
|
418
379
|
Coerces the key into a string if possible, and sees if that can provide a valid case match
|
419
380
|
|
420
381
|
#### 3.2 - Hash matched against an Object
|
421
382
|
|
422
383
|
1. Does the object respond to the match key?
|
423
|
-
2.
|
424
|
-
3. Does
|
425
|
-
4. Does a predicate method exist for it?
|
384
|
+
2. Does the result of sending the match key as a method case match the provided value?
|
385
|
+
3. Does a predicate method exist for it?
|
426
386
|
|
427
387
|
##### 3.2.1 - Responds to match key
|
428
388
|
|
429
389
|
If it doesn't know how to deal with it, false out.
|
430
390
|
|
431
|
-
##### 3.2.2 -
|
432
|
-
|
433
|
-
Same as other wildcards, but if the object doesn't respond to the method you specify it'll have false'd out before it reaches here.
|
434
|
-
|
435
|
-
##### 3.2.3 - Case match present
|
391
|
+
##### 3.2.2 - Case match present
|
436
392
|
|
437
393
|
This is where we can get into some interesting code, much like the hash selections above
|
438
394
|
|
@@ -456,7 +412,7 @@ people_objects.select(&Qo[name: /Rob/])
|
|
456
412
|
# => [Person(Robert, 22), Person(Roberta, 22)]
|
457
413
|
```
|
458
414
|
|
459
|
-
##### 3.2.
|
415
|
+
##### 3.2.3 - Predicate match present
|
460
416
|
|
461
417
|
```ruby
|
462
418
|
# Standalone
|
@@ -484,16 +440,16 @@ This is where I start going a bit off into the weeds. We're going to try and get
|
|
484
440
|
|
485
441
|
```ruby
|
486
442
|
Qo.match(['Robert', 22],
|
487
|
-
Qo.m(
|
488
|
-
Qo.m(
|
443
|
+
Qo.m(Any, 20..99) { |n, a| "#{n} is an adult that is #{a} years old" },
|
444
|
+
Qo.m(Any)
|
489
445
|
)
|
490
446
|
# => "Robert is an adult that is 22 years old"
|
491
447
|
```
|
492
448
|
|
493
449
|
```ruby
|
494
450
|
Qo.match(people_objects.first,
|
495
|
-
Qo.m(name:
|
496
|
-
Qo.m(
|
451
|
+
Qo.m(name: Any, age: 20..99) { |person| "#{person.name} is an adult that is #{person.age} years old" },
|
452
|
+
Qo.m(Any)
|
497
453
|
)
|
498
454
|
```
|
499
455
|
|
@@ -514,7 +470,7 @@ people_objects.map(&Qo.match(
|
|
514
470
|
person.name = person.name[0..2]
|
515
471
|
person
|
516
472
|
},
|
517
|
-
Qo.m(
|
473
|
+
Qo.m(Any)
|
518
474
|
))
|
519
475
|
|
520
476
|
# => [Person(age: 22, name: "Rob"), Person(age: 22, name: "Rob"), Person(age: 42, name: "Foo"), Person(age: 17, name: "Bar")]
|
@@ -619,7 +575,7 @@ HTTP responses.
|
|
619
575
|
def get_url(url)
|
620
576
|
Net::HTTP.get_response(URI(url)).yield_self(&Qo.match(
|
621
577
|
Qo.m(Net::HTTPSuccess) { |response| response.body.size },
|
622
|
-
Qo.m(
|
578
|
+
Qo.m(Any) { |response| raise response.message }
|
623
579
|
))
|
624
580
|
end
|
625
581
|
|
data/docs/Qo.html
CHANGED
@@ -84,7 +84,7 @@
|
|
84
84
|
<dl>
|
85
85
|
<dt>Defined in:</dt>
|
86
86
|
<dd>lib/qo.rb<span class="defines">,<br />
|
87
|
-
lib/qo/helpers.rb,<br /> lib/qo/version.rb,<br /> lib/qo/exceptions.rb,<br /> lib/qo/public_api.rb,<br /> lib/qo/matchers/base_matcher.rb,<br /> 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>
|
87
|
+
lib/qo/helpers.rb,<br /> lib/qo/version.rb,<br /> lib/qo/exceptions.rb,<br /> lib/qo/public_api.rb,<br /> lib/qo/matchers/base_matcher.rb,<br /> 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>
|
88
88
|
</dd>
|
89
89
|
</dl>
|
90
90
|
|
@@ -104,15 +104,10 @@
|
|
104
104
|
<h2>Constant Summary</h2>
|
105
105
|
<dl class="constants">
|
106
106
|
|
107
|
-
<dt id="WILDCARD_MATCH-constant" class="">WILDCARD_MATCH =
|
108
|
-
|
109
|
-
</dt>
|
110
|
-
<dd><pre class="code"><span class='symbol'>:*</span></pre></dd>
|
111
|
-
|
112
107
|
<dt id="VERSION-constant" class="">VERSION =
|
113
108
|
|
114
109
|
</dt>
|
115
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.
|
110
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.4.0</span><span class='tstring_end'>'</span></span></pre></dd>
|
116
111
|
|
117
112
|
</dl>
|
118
113
|
|
@@ -155,9 +150,9 @@
|
|
155
150
|
</div>
|
156
151
|
|
157
152
|
<div id="footer">
|
158
|
-
Generated on Sun
|
153
|
+
Generated on Sun Aug 5 20:52:09 2018 by
|
159
154
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
160
|
-
0.9.12 (ruby-2.
|
155
|
+
0.9.12 (ruby-2.5.1).
|
161
156
|
</div>
|
162
157
|
|
163
158
|
</div>
|
data/docs/Qo/Exceptions.html
CHANGED
@@ -134,7 +134,7 @@
|
|
134
134
|
|
135
135
|
|
136
136
|
|
137
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Exceptions/MultipleMatchersProvided.html" title="Qo::Exceptions::MultipleMatchersProvided (class)">MultipleMatchersProvided</a></span>, <span class='object_link'><a href="Exceptions/NoMatchersProvided.html" title="Qo::Exceptions::NoMatchersProvided (class)">NoMatchersProvided</a></span>, <span class='object_link'><a href="Exceptions/NotAllGuardMatchersProvided.html" title="Qo::Exceptions::NotAllGuardMatchersProvided (class)">NotAllGuardMatchersProvided</a></span>
|
137
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Exceptions/MultipleElseClauses.html" title="Qo::Exceptions::MultipleElseClauses (class)">MultipleElseClauses</a></span>, <span class='object_link'><a href="Exceptions/MultipleMatchersProvided.html" title="Qo::Exceptions::MultipleMatchersProvided (class)">MultipleMatchersProvided</a></span>, <span class='object_link'><a href="Exceptions/NoMatchersProvided.html" title="Qo::Exceptions::NoMatchersProvided (class)">NoMatchersProvided</a></span>, <span class='object_link'><a href="Exceptions/NotAllGuardMatchersProvided.html" title="Qo::Exceptions::NotAllGuardMatchersProvided (class)">NotAllGuardMatchersProvided</a></span>
|
138
138
|
|
139
139
|
|
140
140
|
</p>
|
@@ -150,9 +150,9 @@
|
|
150
150
|
</div>
|
151
151
|
|
152
152
|
<div id="footer">
|
153
|
-
Generated on Sun
|
153
|
+
Generated on Sun Aug 5 20:52:09 2018 by
|
154
154
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
155
|
-
0.9.12 (ruby-2.
|
155
|
+
0.9.12 (ruby-2.5.1).
|
156
156
|
</div>
|
157
157
|
|
158
158
|
</div>
|
@@ -0,0 +1,257 @@
|
|
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::MultipleElseClauses
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.12
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Qo::Exceptions::MultipleElseClauses";
|
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 (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../Qo.html" title="Qo (module)">Qo</a></span></span> » <span class='title'><span class='object_link'><a href="../Exceptions.html" title="Qo::Exceptions (module)">Exceptions</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">MultipleElseClauses</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::MultipleElseClauses
|
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::MultipleElseClauses</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 should only have one "else" clause</p>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
<div class="tags">
|
112
|
+
|
113
|
+
<p class="tag_title">Author:</p>
|
114
|
+
<ul class="author">
|
115
|
+
|
116
|
+
<li>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<div class='inline'><p>baweaver</p>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
</li>
|
126
|
+
|
127
|
+
</ul>
|
128
|
+
<p class="tag_title">Since:</p>
|
129
|
+
<ul class="since">
|
130
|
+
|
131
|
+
<li>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<div class='inline'><p>0.3.0</p>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
</li>
|
141
|
+
|
142
|
+
</ul>
|
143
|
+
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<h2>
|
153
|
+
Instance Method Summary
|
154
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
155
|
+
</h2>
|
156
|
+
|
157
|
+
<ul class="summary">
|
158
|
+
|
159
|
+
<li class="public ">
|
160
|
+
<span class="summary_signature">
|
161
|
+
|
162
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> ⇒ Object </a>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</span>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
177
|
+
|
178
|
+
</li>
|
179
|
+
|
180
|
+
|
181
|
+
</ul>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
<div id="instance_method_details" class="method_details_list">
|
188
|
+
<h2>Instance Method Details</h2>
|
189
|
+
|
190
|
+
|
191
|
+
<div class="method_details first">
|
192
|
+
<h3 class="signature first" id="to_s-instance_method">
|
193
|
+
|
194
|
+
#<strong>to_s</strong> ⇒ <tt>Object</tt>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
</h3><div class="docstring">
|
201
|
+
<div class="discussion">
|
202
|
+
|
203
|
+
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
<div class="tags">
|
207
|
+
|
208
|
+
<p class="tag_title">Since:</p>
|
209
|
+
<ul class="since">
|
210
|
+
|
211
|
+
<li>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<div class='inline'><p>0.3.0</p>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
</ul>
|
223
|
+
|
224
|
+
</div><table class="source_code">
|
225
|
+
<tr>
|
226
|
+
<td>
|
227
|
+
<pre class="lines">
|
228
|
+
|
229
|
+
|
230
|
+
49
|
231
|
+
50
|
232
|
+
51</pre>
|
233
|
+
</td>
|
234
|
+
<td>
|
235
|
+
<pre class="code"><span class="info file"># File 'lib/qo/exceptions.rb', line 49</span>
|
236
|
+
|
237
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
238
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot have more than one `else` clause in a Pattern Match.</span><span class='tstring_end'>"</span></span>
|
239
|
+
<span class='kw'>end</span></pre>
|
240
|
+
</td>
|
241
|
+
</tr>
|
242
|
+
</table>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
</div>
|
246
|
+
|
247
|
+
</div>
|
248
|
+
|
249
|
+
<div id="footer">
|
250
|
+
Generated on Sun Aug 5 20:52:10 2018 by
|
251
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
252
|
+
0.9.12 (ruby-2.5.1).
|
253
|
+
</div>
|
254
|
+
|
255
|
+
</div>
|
256
|
+
</body>
|
257
|
+
</html>
|