shenanigans 1.0.11 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/doc/Array.html +57 -56
- data/doc/Fixnum.html +47 -46
- data/doc/Hash.html +61 -59
- data/doc/Kernel.html +57 -59
- data/doc/Module.html +49 -48
- data/doc/Object.html +51 -49
- data/doc/String.html +51 -49
- data/doc/_index.html +28 -31
- data/doc/class_list.html +24 -27
- data/doc/css/full_list.css +32 -31
- data/doc/css/style.css +251 -90
- data/doc/file.README.html +30 -32
- data/doc/file_list.html +26 -26
- data/doc/frames.html +7 -16
- data/doc/index.html +30 -32
- data/doc/js/app.js +106 -77
- data/doc/js/full_list.js +170 -132
- data/doc/method_list.html +108 -76
- data/doc/top-level-namespace.html +34 -36
- data/lib/shenanigans/kernel/fn.rb +1 -1
- data/lib/shenanigans/kernel/prompt.rb +1 -1
- data/lib/shenanigans/kernel/require_optional.rb +1 -1
- data/lib/shenanigans/kernel/with.rb +1 -1
- data/lib/shenanigans/module/private_accessor.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a9f1eccb5f91c4900d73028357417c17999b7c69b5e775d506973fd90eeff8d6
|
4
|
+
data.tar.gz: 8c3d497d30c2081f7262096c3af8a7c3e65cec4d0841265476bae9943bd0a302
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3feeb73a90347f1270f214a7fab07316c08823908c1fc76f434a56bccd40e1a600cf2155942469d2028bcef60fa02d8391b163b95d3f4dcc1b621711ece36e2
|
7
|
+
data.tar.gz: d9e206db73770af8e1265152eedcfbcca3ffdfb60bb1afc0f1fc0ae9c10704062d862dbc5f9b99bf90d5bf4be512dd57c75408da99c2944cf2bcc3d06ef40d17
|
data/doc/Array.html
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
7
|
Class: Array
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.9.12
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,9 +15,8 @@
|
|
15
15
|
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
18
|
+
pathId = "Array";
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
20
|
</script>
|
22
21
|
|
23
22
|
|
@@ -28,51 +27,48 @@
|
|
28
27
|
|
29
28
|
</head>
|
30
29
|
<body>
|
31
|
-
<div
|
32
|
-
<
|
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">
|
33
38
|
|
34
39
|
<a href="_index.html">Index (A)</a> »
|
35
40
|
|
36
41
|
|
37
42
|
<span class="title">Array</span>
|
38
43
|
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
44
|
</div>
|
42
45
|
|
43
|
-
|
46
|
+
<div id="search">
|
44
47
|
|
45
48
|
<a class="full_list_link" id="class_list_link"
|
46
49
|
href="class_list.html">
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="file_list.html">
|
57
|
-
File List
|
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>
|
58
56
|
</a>
|
59
57
|
|
60
58
|
</div>
|
61
|
-
|
62
|
-
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: Array
|
62
|
+
<div id="content"><h1>Class: Array
|
67
63
|
|
68
64
|
|
69
65
|
|
70
66
|
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
67
|
+
<div class="box_info">
|
73
68
|
|
74
|
-
|
75
|
-
<
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
76
72
|
<span class="inheritName"><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></span>
|
77
73
|
|
78
74
|
<ul class="fullTree">
|
@@ -83,23 +79,27 @@
|
|
83
79
|
</ul>
|
84
80
|
<a href="#" class="inheritanceTree">show all</a>
|
85
81
|
|
86
|
-
|
87
|
-
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
88
86
|
|
89
87
|
|
90
|
-
|
91
88
|
|
92
|
-
|
93
89
|
|
94
90
|
|
91
|
+
|
95
92
|
|
96
|
-
|
97
|
-
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/shenanigans/array/caret.rb<span class="defines">,<br />
|
98
98
|
lib/shenanigans/array/zip_with.rb,<br /> lib/shenanigans/array/reductions.rb,<br /> lib/shenanigans/array/random_subarray.rb</span>
|
99
99
|
</dd>
|
100
|
+
</dl>
|
100
101
|
|
101
|
-
</
|
102
|
-
<div class="clear"></div>
|
102
|
+
</div>
|
103
103
|
|
104
104
|
|
105
105
|
|
@@ -111,7 +111,7 @@
|
|
111
111
|
|
112
112
|
<h2>
|
113
113
|
Instance Method Summary
|
114
|
-
<small
|
114
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
115
115
|
</h2>
|
116
116
|
|
117
117
|
<ul class="summary">
|
@@ -119,7 +119,7 @@
|
|
119
119
|
<li class="public ">
|
120
120
|
<span class="summary_signature">
|
121
121
|
|
122
|
-
<a href="#%5E-instance_method" title="#^ (instance method)"
|
122
|
+
<a href="#%5E-instance_method" title="#^ (instance method)">#<strong>^</strong>(other) ⇒ Object </a>
|
123
123
|
|
124
124
|
|
125
125
|
|
@@ -143,7 +143,7 @@
|
|
143
143
|
<li class="public ">
|
144
144
|
<span class="summary_signature">
|
145
145
|
|
146
|
-
<a href="#random_subarray-instance_method" title="#random_subarray (instance method)"
|
146
|
+
<a href="#random_subarray-instance_method" title="#random_subarray (instance method)">#<strong>random_subarray</strong>(n = 1) ⇒ Object </a>
|
147
147
|
|
148
148
|
|
149
149
|
|
@@ -167,7 +167,7 @@
|
|
167
167
|
<li class="public ">
|
168
168
|
<span class="summary_signature">
|
169
169
|
|
170
|
-
<a href="#reductions-instance_method" title="#reductions (instance method)"
|
170
|
+
<a href="#reductions-instance_method" title="#reductions (instance method)">#<strong>reductions</strong>(*args, &block) ⇒ Object </a>
|
171
171
|
|
172
172
|
|
173
173
|
|
@@ -192,7 +192,7 @@ intermediate values.</p>
|
|
192
192
|
<li class="public ">
|
193
193
|
<span class="summary_signature">
|
194
194
|
|
195
|
-
<a href="#zip_with-instance_method" title="#zip_with (instance method)"
|
195
|
+
<a href="#zip_with-instance_method" title="#zip_with (instance method)">#<strong>zip_with</strong>(other, op = nil) ⇒ Object </a>
|
196
196
|
|
197
197
|
|
198
198
|
|
@@ -207,8 +207,8 @@ intermediate values.</p>
|
|
207
207
|
|
208
208
|
|
209
209
|
<span class="summary_desc"><div class='inline'>
|
210
|
-
<p>Zip self with other
|
211
|
-
symbol.</p>
|
210
|
+
<p>Zip <code>self</code> with <code>other</code>, combining the elements with
|
211
|
+
the provided block or symbol.</p>
|
212
212
|
</div></span>
|
213
213
|
|
214
214
|
</li>
|
@@ -226,7 +226,7 @@ symbol.</p>
|
|
226
226
|
<div class="method_details first">
|
227
227
|
<h3 class="signature first" id="^-instance_method">
|
228
228
|
|
229
|
-
|
229
|
+
#<strong>^</strong>(other) ⇒ <tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>
|
230
230
|
|
231
231
|
|
232
232
|
|
@@ -271,7 +271,7 @@ symbol.</p>
|
|
271
271
|
<div class="method_details ">
|
272
272
|
<h3 class="signature " id="random_subarray-instance_method">
|
273
273
|
|
274
|
-
|
274
|
+
#<strong>random_subarray</strong>(n = 1) ⇒ <tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>
|
275
275
|
|
276
276
|
|
277
277
|
|
@@ -339,7 +339,7 @@ performant uniform distributions even for large arrays.</p>
|
|
339
339
|
<div class="method_details ">
|
340
340
|
<h3 class="signature " id="reductions-instance_method">
|
341
341
|
|
342
|
-
|
342
|
+
#<strong>reductions</strong>(*args, &block) ⇒ <tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>
|
343
343
|
|
344
344
|
|
345
345
|
|
@@ -359,7 +359,7 @@ both can be supplied. This method may eventually be moved to the
|
|
359
359
|
<span class='comment'>#=> 10
|
360
360
|
</span><span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_reductions'>reductions</span><span class='lparen'>(</span><span class='int'>50</span><span class='comma'>,</span> <span class='symbol'>:+</span><span class='rparen'>)</span>
|
361
361
|
<span class='comment'>#=> 60
|
362
|
-
</span><span class='qwords_beg'>%w(</span><span class='tstring_content'>a</span><span class='words_sep'> </span><span class='tstring_content'>b</span><span class='words_sep'> </span><span class='tstring_content'>c</span><span class='
|
362
|
+
</span><span class='qwords_beg'>%w(</span><span class='tstring_content'>a</span><span class='words_sep'> </span><span class='tstring_content'>b</span><span class='words_sep'> </span><span class='tstring_content'>c</span><span class='tstring_end'>)</span></span><span class='period'>.</span><span class='id identifier rubyid_reductions'>reductions</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s1'>s1</span><span class='comma'>,</span> <span class='id identifier rubyid_s2'>s2</span><span class='op'>|</span> <span class='id identifier rubyid_s1'>s1</span><span class='op'>+</span><span class='id identifier rubyid_s2'>s2</span> <span class='rbrace'>}</span>
|
363
363
|
<span class='comment'>#=> ["a", "ab", "abc"]
|
364
364
|
</span></code></pre>
|
365
365
|
|
@@ -436,7 +436,7 @@ both can be supplied. This method may eventually be moved to the
|
|
436
436
|
<div class="method_details ">
|
437
437
|
<h3 class="signature " id="zip_with-instance_method">
|
438
438
|
|
439
|
-
|
439
|
+
#<strong>zip_with</strong>(other, op = nil) ⇒ <tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>
|
440
440
|
|
441
441
|
|
442
442
|
|
@@ -451,7 +451,7 @@ shorter of the two arrays.</p>
|
|
451
451
|
|
452
452
|
<pre class="code ruby"><code class="ruby"><span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span><span class='int'>2</span><span class='comma'>,</span><span class='int'>3</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_zip_with'>zip_with</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='int'>6</span><span class='comma'>,</span><span class='int'>5</span><span class='comma'>,</span><span class='int'>4</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:+</span><span class='rparen'>)</span>
|
453
453
|
<span class='comment'>#=> [7, 7, 7]
|
454
|
-
</span><span class='qwords_beg'>%w(</span><span class='tstring_content'>a</span><span class='words_sep'> </span><span class='tstring_content'>b</span><span class='
|
454
|
+
</span><span class='qwords_beg'>%w(</span><span class='tstring_content'>a</span><span class='words_sep'> </span><span class='tstring_content'>b</span><span class='tstring_end'>)</span></span><span class='period'>.</span><span class='id identifier rubyid_zip_with'>zip_with</span><span class='lparen'>(</span><span class='qwords_beg'>%w(</span><span class='tstring_content'>c</span><span class='words_sep'> </span><span class='tstring_content'>d</span><span class='tstring_end'>)</span></span><span class='comma'>,</span> <span class='symbol'>:+</span><span class='rparen'>)</span>
|
455
455
|
<span class='comment'>#=> ["ac", "bd"]
|
456
456
|
</span></code></pre>
|
457
457
|
|
@@ -508,11 +508,12 @@ shorter of the two arrays.</p>
|
|
508
508
|
|
509
509
|
</div>
|
510
510
|
|
511
|
-
|
512
|
-
Generated on
|
511
|
+
<div id="footer">
|
512
|
+
Generated on Thu Feb 1 16:36:54 2018 by
|
513
513
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
514
|
-
0.
|
514
|
+
0.9.12 (ruby-2.5.0).
|
515
515
|
</div>
|
516
516
|
|
517
|
+
</div>
|
517
518
|
</body>
|
518
519
|
</html>
|
data/doc/Fixnum.html
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
7
|
Class: Fixnum
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.9.12
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,9 +15,8 @@
|
|
15
15
|
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
18
|
+
pathId = "Fixnum";
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
20
|
</script>
|
22
21
|
|
23
22
|
|
@@ -28,51 +27,48 @@
|
|
28
27
|
|
29
28
|
</head>
|
30
29
|
<body>
|
31
|
-
<div
|
32
|
-
<
|
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">
|
33
38
|
|
34
39
|
<a href="_index.html">Index (F)</a> »
|
35
40
|
|
36
41
|
|
37
42
|
<span class="title">Fixnum</span>
|
38
43
|
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
44
|
</div>
|
42
45
|
|
43
|
-
|
46
|
+
<div id="search">
|
44
47
|
|
45
48
|
<a class="full_list_link" id="class_list_link"
|
46
49
|
href="class_list.html">
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="file_list.html">
|
57
|
-
File List
|
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>
|
58
56
|
</a>
|
59
57
|
|
60
58
|
</div>
|
61
|
-
|
62
|
-
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: Fixnum
|
62
|
+
<div id="content"><h1>Class: Fixnum
|
67
63
|
|
68
64
|
|
69
65
|
|
70
66
|
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
67
|
+
<div class="box_info">
|
73
68
|
|
74
|
-
|
75
|
-
<
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
76
72
|
<span class="inheritName"><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></span>
|
77
73
|
|
78
74
|
<ul class="fullTree">
|
@@ -83,21 +79,25 @@
|
|
83
79
|
</ul>
|
84
80
|
<a href="#" class="inheritanceTree">show all</a>
|
85
81
|
|
86
|
-
|
87
|
-
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
88
86
|
|
89
87
|
|
90
|
-
|
91
88
|
|
92
|
-
|
93
89
|
|
94
90
|
|
91
|
+
|
92
|
+
|
93
|
+
|
95
94
|
|
96
|
-
|
97
|
-
<
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/shenanigans/fixnum/string_length.rb</dd>
|
98
|
+
</dl>
|
98
99
|
|
99
|
-
</
|
100
|
-
<div class="clear"></div>
|
100
|
+
</div>
|
101
101
|
|
102
102
|
|
103
103
|
|
@@ -109,7 +109,7 @@
|
|
109
109
|
|
110
110
|
<h2>
|
111
111
|
Instance Method Summary
|
112
|
-
<small
|
112
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
113
113
|
</h2>
|
114
114
|
|
115
115
|
<ul class="summary">
|
@@ -117,7 +117,7 @@
|
|
117
117
|
<li class="public ">
|
118
118
|
<span class="summary_signature">
|
119
119
|
|
120
|
-
<a href="#string_length-instance_method" title="#string_length (instance method)"
|
120
|
+
<a href="#string_length-instance_method" title="#string_length (instance method)">#<strong>string_length</strong> ⇒ Object </a>
|
121
121
|
|
122
122
|
|
123
123
|
|
@@ -150,7 +150,7 @@
|
|
150
150
|
<div class="method_details first">
|
151
151
|
<h3 class="signature first" id="string_length-instance_method">
|
152
152
|
|
153
|
-
|
153
|
+
#<strong>string_length</strong> ⇒ <tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>
|
154
154
|
|
155
155
|
|
156
156
|
|
@@ -204,11 +204,12 @@
|
|
204
204
|
|
205
205
|
</div>
|
206
206
|
|
207
|
-
|
208
|
-
Generated on
|
207
|
+
<div id="footer">
|
208
|
+
Generated on Thu Feb 1 16:36:55 2018 by
|
209
209
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
210
|
-
0.
|
210
|
+
0.9.12 (ruby-2.5.0).
|
211
211
|
</div>
|
212
212
|
|
213
|
+
</div>
|
213
214
|
</body>
|
214
215
|
</html>
|
data/doc/Hash.html
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
7
|
Class: Hash
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.9.12
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,9 +15,8 @@
|
|
15
15
|
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
18
|
+
pathId = "Hash";
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
20
|
</script>
|
22
21
|
|
23
22
|
|
@@ -28,51 +27,48 @@
|
|
28
27
|
|
29
28
|
</head>
|
30
29
|
<body>
|
31
|
-
<div
|
32
|
-
<
|
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">
|
33
38
|
|
34
39
|
<a href="_index.html">Index (H)</a> »
|
35
40
|
|
36
41
|
|
37
42
|
<span class="title">Hash</span>
|
38
43
|
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
44
|
</div>
|
42
45
|
|
43
|
-
|
46
|
+
<div id="search">
|
44
47
|
|
45
48
|
<a class="full_list_link" id="class_list_link"
|
46
49
|
href="class_list.html">
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="file_list.html">
|
57
|
-
File List
|
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>
|
58
56
|
</a>
|
59
57
|
|
60
58
|
</div>
|
61
|
-
|
62
|
-
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: Hash
|
62
|
+
<div id="content"><h1>Class: Hash
|
67
63
|
|
68
64
|
|
69
65
|
|
70
66
|
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
67
|
+
<div class="box_info">
|
73
68
|
|
74
|
-
|
75
|
-
<
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
76
72
|
<span class="inheritName"><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></span>
|
77
73
|
|
78
74
|
<ul class="fullTree">
|
@@ -83,23 +79,27 @@
|
|
83
79
|
</ul>
|
84
80
|
<a href="#" class="inheritanceTree">show all</a>
|
85
81
|
|
86
|
-
|
87
|
-
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
88
86
|
|
89
87
|
|
90
|
-
|
91
88
|
|
92
|
-
|
93
89
|
|
94
90
|
|
91
|
+
|
95
92
|
|
96
|
-
|
97
|
-
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/shenanigans/hash/extract.rb<span class="defines">,<br />
|
98
98
|
lib/shenanigans/hash/to_ostruct.rb,<br /> lib/shenanigans/hash/has_shape_pred.rb</span>
|
99
99
|
</dd>
|
100
|
+
</dl>
|
100
101
|
|
101
|
-
</
|
102
|
-
<div class="clear"></div>
|
102
|
+
</div>
|
103
103
|
|
104
104
|
|
105
105
|
|
@@ -111,7 +111,7 @@
|
|
111
111
|
|
112
112
|
<h2>
|
113
113
|
Instance Method Summary
|
114
|
-
<small
|
114
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
115
115
|
</h2>
|
116
116
|
|
117
117
|
<ul class="summary">
|
@@ -119,7 +119,7 @@
|
|
119
119
|
<li class="public ">
|
120
120
|
<span class="summary_signature">
|
121
121
|
|
122
|
-
<a href="#extract-instance_method" title="#extract (instance method)"
|
122
|
+
<a href="#extract-instance_method" title="#extract (instance method)">#<strong>extract</strong>(*ks) ⇒ Object </a>
|
123
123
|
|
124
124
|
|
125
125
|
|
@@ -143,7 +143,7 @@
|
|
143
143
|
<li class="public ">
|
144
144
|
<span class="summary_signature">
|
145
145
|
|
146
|
-
<a href="#has_shape%3F-instance_method" title="#has_shape? (instance method)"
|
146
|
+
<a href="#has_shape%3F-instance_method" title="#has_shape? (instance method)">#<strong>has_shape?</strong>(shape) ⇒ Boolean </a>
|
147
147
|
|
148
148
|
|
149
149
|
|
@@ -167,7 +167,7 @@
|
|
167
167
|
<li class="public ">
|
168
168
|
<span class="summary_signature">
|
169
169
|
|
170
|
-
<a href="#to_ostruct-instance_method" title="#to_ostruct (instance method)"
|
170
|
+
<a href="#to_ostruct-instance_method" title="#to_ostruct (instance method)">#<strong>to_ostruct</strong> ⇒ Object </a>
|
171
171
|
|
172
172
|
|
173
173
|
|
@@ -182,7 +182,8 @@
|
|
182
182
|
|
183
183
|
|
184
184
|
<span class="summary_desc"><div class='inline'>
|
185
|
-
<p>Recursively converts a Hash and all nested
|
185
|
+
<p>Recursively converts a <code>Hash</code> and all nested <code>Hash</code>es
|
186
|
+
to <code>OpenStruct</code>s.</p>
|
186
187
|
</div></span>
|
187
188
|
|
188
189
|
</li>
|
@@ -200,7 +201,7 @@
|
|
200
201
|
<div class="method_details first">
|
201
202
|
<h3 class="signature first" id="extract-instance_method">
|
202
203
|
|
203
|
-
|
204
|
+
#<strong>extract</strong>(*ks) ⇒ <tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>
|
204
205
|
|
205
206
|
|
206
207
|
|
@@ -240,7 +241,7 @@
|
|
240
241
|
|
241
242
|
<span class='kw'>def</span> <span class='id identifier rubyid_extract'>extract</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_ks'>ks</span><span class='rparen'>)</span>
|
242
243
|
<span class='id identifier rubyid_existing'>existing</span> <span class='op'>=</span> <span class='id identifier rubyid_keys'>keys</span> <span class='op'>&</span> <span class='id identifier rubyid_ks'>ks</span>
|
243
|
-
<span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_existing'>existing</span><span class='period'>.</span><span class='id identifier rubyid_zip'>zip</span><span class='lparen'>(</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_existing'>existing</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
244
|
+
<span class='const'><span class='object_link'><a href="" title="Hash (class)">Hash</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_existing'>existing</span><span class='period'>.</span><span class='id identifier rubyid_zip'>zip</span><span class='lparen'>(</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_existing'>existing</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
244
245
|
<span class='kw'>end</span></pre>
|
245
246
|
</td>
|
246
247
|
</tr>
|
@@ -250,7 +251,7 @@
|
|
250
251
|
<div class="method_details ">
|
251
252
|
<h3 class="signature " id="has_shape?-instance_method">
|
252
253
|
|
253
|
-
|
254
|
+
#<strong>has_shape?</strong>(shape) ⇒ <tt>Boolean</tt>
|
254
255
|
|
255
256
|
|
256
257
|
|
@@ -262,16 +263,16 @@
|
|
262
263
|
<p>Checks if a hash has a certain structure.</p>
|
263
264
|
|
264
265
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>k1:</span> <span class='int'>1</span><span class='comma'>,</span> <span class='label'>k2:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1</span><span class='tstring_end'>"</span></span> <span class='rbrace'>}</span>
|
265
|
-
<span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_has_shape?'>has_shape?</span><span class='lparen'>(</span><span class='label'>k1:</span> <span class='const'>Fixnum</span><span class='comma'>,</span> <span class='label'>k2:</span> <span class='const'>String</span><span class='rparen'>)</span>
|
266
|
+
<span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_has_shape?'>has_shape?</span><span class='lparen'>(</span><span class='label'>k1:</span> <span class='const'><span class='object_link'><a href="Fixnum.html" title="Fixnum (class)">Fixnum</a></span></span><span class='comma'>,</span> <span class='label'>k2:</span> <span class='const'><span class='object_link'><a href="String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
|
266
267
|
<span class='comment'>#=> true
|
267
|
-
</span><span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_has_shape?'>has_shape?</span><span class='lparen'>(</span><span class='label'>k1:</span> <span class='const'>Class</span><span class='comma'>,</span> <span class='label'>k2:</span> <span class='const'>String</span><span class='rparen'>)</span>
|
268
|
+
</span><span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_has_shape?'>has_shape?</span><span class='lparen'>(</span><span class='label'>k1:</span> <span class='const'>Class</span><span class='comma'>,</span> <span class='label'>k2:</span> <span class='const'><span class='object_link'><a href="String.html" title="String (class)">String</a></span></span><span class='rparen'>)</span>
|
268
269
|
<span class='comment'>#=> false
|
269
270
|
</span></code></pre>
|
270
271
|
|
271
272
|
<p>It also works with compound data structures.</p>
|
272
273
|
|
273
274
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>k1:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>k2:</span> <span class='lbrace'>{</span> <span class='label'>k3:</span> <span class='const'>Struct</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Foo</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
274
|
-
<span class='id identifier rubyid_shape'>shape</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>k1:</span> <span class='const'>Array</span><span class='comma'>,</span> <span class='label'>k2:</span> <span class='lbrace'>{</span> <span class='label'>k3:</span> <span class='const'>Module</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
275
|
+
<span class='id identifier rubyid_shape'>shape</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>k1:</span> <span class='const'><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></span><span class='comma'>,</span> <span class='label'>k2:</span> <span class='lbrace'>{</span> <span class='label'>k3:</span> <span class='const'><span class='object_link'><a href="Module.html" title="Module (class)">Module</a></span></span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
275
276
|
<span class='id identifier rubyid_h'>h</span><span class='period'>.</span><span class='id identifier rubyid_has_shape?'>has_shape?</span><span class='lparen'>(</span><span class='id identifier rubyid_shape'>shape</span><span class='rparen'>)</span>
|
276
277
|
<span class='comment'>#=> true
|
277
278
|
</span></code></pre>
|
@@ -312,7 +313,7 @@
|
|
312
313
|
|
313
314
|
<span class='kw'>def</span> <span class='id identifier rubyid_has_shape?'>has_shape?</span><span class='lparen'>(</span><span class='id identifier rubyid_shape'>shape</span><span class='rparen'>)</span>
|
314
315
|
<span class='id identifier rubyid_all?'>all?</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>
|
315
|
-
<span class='const'>Hash</span> <span class='op'>===</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>?</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_has_shape?'>has_shape?</span><span class='lparen'>(</span><span class='id identifier rubyid_shape'>shape</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_shape'>shape</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>
|
316
|
+
<span class='const'><span class='object_link'><a href="" title="Hash (class)">Hash</a></span></span> <span class='op'>===</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>?</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_has_shape?'>has_shape?</span><span class='lparen'>(</span><span class='id identifier rubyid_shape'>shape</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_shape'>shape</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>
|
316
317
|
<span class='kw'>end</span>
|
317
318
|
<span class='kw'>end</span></pre>
|
318
319
|
</td>
|
@@ -323,7 +324,7 @@
|
|
323
324
|
<div class="method_details ">
|
324
325
|
<h3 class="signature " id="to_ostruct-instance_method">
|
325
326
|
|
326
|
-
|
327
|
+
#<strong>to_ostruct</strong> ⇒ <tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>
|
327
328
|
|
328
329
|
|
329
330
|
|
@@ -386,15 +387,15 @@ languages:
|
|
386
387
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_ostruct'>to_ostruct</span>
|
387
388
|
<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='id identifier rubyid_map'>map</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>
|
388
389
|
<span class='kw'>case</span> <span class='id identifier rubyid_v'>v</span>
|
389
|
-
<span class='kw'>when</span> <span class='const'>Hash</span>
|
390
|
+
<span class='kw'>when</span> <span class='const'><span class='object_link'><a href="" title="Hash (class)">Hash</a></span></span>
|
390
391
|
<span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_ostruct'>to_ostruct</span><span class='rbracket'>]</span>
|
391
|
-
<span class='kw'>when</span> <span class='const'>Array</span>
|
392
|
+
<span class='kw'>when</span> <span class='const'><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></span>
|
392
393
|
<span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:to_ostruct</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_to_ostruct'>to_ostruct</span> <span class='op'>:</span> <span class='id identifier rubyid_el'>el</span> <span class='rbrace'>}</span><span class='rbracket'>]</span>
|
393
394
|
<span class='kw'>else</span>
|
394
395
|
<span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rbracket'>]</span>
|
395
396
|
<span class='kw'>end</span>
|
396
397
|
<span class='kw'>end</span>
|
397
|
-
<span class='const'>OpenStruct</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_arr'>arr</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
398
|
+
<span class='const'>OpenStruct</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="" title="Hash (class)">Hash</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_arr'>arr</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
398
399
|
<span class='kw'>end</span></pre>
|
399
400
|
</td>
|
400
401
|
</tr>
|
@@ -405,11 +406,12 @@ languages:
|
|
405
406
|
|
406
407
|
</div>
|
407
408
|
|
408
|
-
|
409
|
-
Generated on
|
409
|
+
<div id="footer">
|
410
|
+
Generated on Thu Feb 1 16:36:55 2018 by
|
410
411
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
411
|
-
0.
|
412
|
+
0.9.12 (ruby-2.5.0).
|
412
413
|
</div>
|
413
414
|
|
415
|
+
</div>
|
414
416
|
</body>
|
415
417
|
</html>
|