shenanigans 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -3
  3. data/README.rdoc +1 -1
  4. data/doc/Array.html +423 -202
  5. data/doc/Fixnum.html +155 -140
  6. data/doc/Hash.html +305 -206
  7. data/doc/Kernel.html +360 -249
  8. data/doc/Module.html +181 -153
  9. data/doc/Object.html +210 -201
  10. data/doc/String.html +166 -139
  11. data/doc/_index.html +188 -0
  12. data/doc/class_list.html +54 -0
  13. data/doc/css/common.css +1 -0
  14. data/doc/css/full_list.css +57 -0
  15. data/doc/css/style.css +338 -0
  16. data/doc/file.README.html +162 -0
  17. data/doc/file_list.html +56 -0
  18. data/doc/frames.html +26 -0
  19. data/doc/index.html +62 -80
  20. data/doc/js/app.js +219 -0
  21. data/doc/js/full_list.js +178 -0
  22. data/doc/js/jquery.js +4 -18
  23. data/doc/method_list.html +149 -0
  24. data/doc/top-level-namespace.html +114 -0
  25. data/lib/shenanigans.rb +3 -1
  26. data/lib/shenanigans/array.rb +3 -3
  27. data/lib/shenanigans/array/reductions.rb +29 -0
  28. data/lib/shenanigans/kernel.rb +4 -4
  29. data/lib/shenanigans/module.rb +1 -1
  30. data/lib/shenanigans/object.rb +2 -2
  31. data/lib/shenanigans/string.rb +1 -1
  32. data/test/array/test_reductions.rb +27 -0
  33. metadata +16 -36
  34. data/doc/README_rdoc.html +0 -199
  35. data/doc/created.rid +0 -25
  36. data/doc/images/add.png +0 -0
  37. data/doc/images/arrow_up.png +0 -0
  38. data/doc/images/brick.png +0 -0
  39. data/doc/images/brick_link.png +0 -0
  40. data/doc/images/bug.png +0 -0
  41. data/doc/images/bullet_black.png +0 -0
  42. data/doc/images/bullet_toggle_minus.png +0 -0
  43. data/doc/images/bullet_toggle_plus.png +0 -0
  44. data/doc/images/date.png +0 -0
  45. data/doc/images/delete.png +0 -0
  46. data/doc/images/find.png +0 -0
  47. data/doc/images/loadingAnimation.gif +0 -0
  48. data/doc/images/macFFBgHack.png +0 -0
  49. data/doc/images/package.png +0 -0
  50. data/doc/images/page_green.png +0 -0
  51. data/doc/images/page_white_text.png +0 -0
  52. data/doc/images/page_white_width.png +0 -0
  53. data/doc/images/plugin.png +0 -0
  54. data/doc/images/ruby.png +0 -0
  55. data/doc/images/tag_blue.png +0 -0
  56. data/doc/images/tag_green.png +0 -0
  57. data/doc/images/transparent.png +0 -0
  58. data/doc/images/wrench.png +0 -0
  59. data/doc/images/wrench_orange.png +0 -0
  60. data/doc/images/zoom.png +0 -0
  61. data/doc/js/darkfish.js +0 -155
  62. data/doc/js/navigation.js +0 -142
  63. data/doc/js/search.js +0 -94
  64. data/doc/js/search_index.js +0 -1
  65. data/doc/js/searcher.js +0 -228
  66. data/doc/rdoc.css +0 -595
  67. data/doc/table_of_contents.html +0 -114
data/doc/Fixnum.html CHANGED
@@ -1,160 +1,165 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Fixnum
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
6
12
 
7
- <title>class Fixnum - Shenanigans</title>
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
8
14
 
9
- <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
10
16
 
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "./";
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
13
21
  </script>
14
22
 
15
- <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
23
 
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
22
25
 
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="./index.html">Home</a>
28
- <a href="./table_of_contents.html#classes">Classes</a>
29
- <a href="./table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
32
27
 
33
28
 
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (F)</a> &raquo;
35
+
36
+
37
+ <span class="title">Fixnum</span>
38
+
44
39
 
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
45
42
 
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
46
49
 
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
47
63
 
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/shenanigans/fixnum/string_length.rb
53
- </ul>
54
- </nav>
64
+ <iframe id="search_frame"></iframe>
55
65
 
56
-
57
- </div>
66
+ <div id="content"><h1>Class: Fixnum
67
+
68
+
69
+
70
+ </h1>
58
71
 
59
- <div id="class-metadata">
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName"><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></span>
77
+
78
+ <ul class="fullTree">
79
+ <li><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></li>
80
+
81
+ <li class="next">Fixnum</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
60
87
 
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
63
88
 
64
- <p class="link"><a href="Object.html">Object</a>
65
89
 
66
- </nav>
67
-
68
90
 
91
+
69
92
 
70
- <!-- Method Quickref -->
71
- <nav id="method-list-section" class="section">
72
- <h3 class="section-header">Methods</h3>
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/shenanigans/fixnum/string_length.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+
73
103
 
74
- <ul class="link-list">
75
-
76
- <li ><a href="#method-i-string_length">#string_length</a>
77
-
78
- </ul>
79
- </nav>
80
104
 
81
- </div>
82
105
 
83
- <div id="project-metadata">
84
- <nav id="fileindex-section" class="section project-section">
85
- <h3 class="section-header">Pages</h3>
86
106
 
87
- <ul>
88
-
89
- <li class="file"><a href="./README_rdoc.html">README</a>
90
-
91
- </ul>
92
- </nav>
93
107
 
94
- <nav id="classindex-section" class="section project-section">
95
- <h3 class="section-header">Class and Module Index</h3>
96
108
 
97
- <ul class="link-list">
98
109
 
99
- <li><a href="./Array.html">Array</a>
110
+ <h2>
111
+ Instance Method Summary
112
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
113
+ </h2>
114
+
115
+ <ul class="summary">
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#string_length-instance_method" title="#string_length (instance method)">- (Object) <strong>string_length</strong> </a>
121
+
122
+
123
+
124
+ </span>
100
125
 
101
- <li><a href="./Fixnum.html">Fixnum</a>
102
126
 
103
- <li><a href="./Hash.html">Hash</a>
104
127
 
105
- <li><a href="./Kernel.html">Kernel</a>
106
128
 
107
- <li><a href="./Module.html">Module</a>
108
129
 
109
- <li><a href="./Object.html">Object</a>
110
130
 
111
- <li><a href="./String.html">String</a>
112
131
 
113
- </ul>
114
- </nav>
115
-
116
- </div>
117
- </nav>
118
-
119
- <div id="documentation">
120
- <h1 class="class">class Fixnum</h1>
121
-
122
- <div id="description" class="description">
123
-
124
- </div><!-- description -->
125
132
 
126
133
 
134
+ <span class="summary_desc"><div class='inline'>
135
+ <p>Returns the length of the number&#39;s string representation.</p>
136
+ </div></span>
127
137
 
138
+ </li>
139
+
140
+
141
+ </ul>
128
142
 
129
- <section id="5Buntitled-5D" class="documentation-section">
130
-
131
143
 
132
-
133
144
 
134
-
135
145
 
136
-
146
+ <div id="instance_method_details" class="method_details_list">
147
+ <h2>Instance Method Details</h2>
137
148
 
138
- <!-- Methods -->
139
149
 
140
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
141
- <h3 class="section-header">Public Instance Methods</h3>
150
+ <div class="method_details first">
151
+ <h3 class="signature first" id="string_length-instance_method">
152
+
153
+ - (<tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>) <strong>string_length</strong>
154
+
142
155
 
143
-
144
- <div id="method-i-string_length" class="method-detail ">
145
-
146
- <div class="method-heading">
147
- <span class="method-name">string_length</span><span
148
- class="method-args">()</span>
149
-
150
- <span class="method-click-advice">click to toggle source</span>
151
-
152
- </div>
153
-
156
+
154
157
 
155
- <div class="method-description">
156
-
157
- <p>Returns the length of the number&#39;s string representation.</p>
158
+
159
+ </h3><div class="docstring">
160
+ <div class="discussion">
161
+
162
+ <p>Returns the length of the number&#39;s string representation.</p>
158
163
 
159
164
  <pre class="ruby"><span class="ruby-value">0</span>.<span class="ruby-identifier">string_length</span>
160
165
  <span class="ruby-comment">#=&gt; 1</span>
@@ -163,37 +168,47 @@
163
168
  <span class="ruby-value">-1</span>.<span class="ruby-identifier">string_length</span>
164
169
  <span class="ruby-comment">#=&gt; 2</span>
165
170
  </pre>
166
-
167
-
168
171
 
169
-
170
- <div class="method-source-code" id="string_length-source">
171
- <pre><span class="ruby-comment"># File lib/shenanigans/fixnum/string_length.rb, line 9</span>
172
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">string_length</span>
173
- <span class="ruby-keyword">return</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">zero?</span>
174
- <span class="ruby-identifier">len</span> = <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log10</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">abs</span>).<span class="ruby-identifier">floor</span>.<span class="ruby-identifier">next</span>
175
- <span class="ruby-keyword">self</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">len</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">len</span>.<span class="ruby-identifier">next</span>
176
- <span class="ruby-keyword">end</span></pre>
177
- </div><!-- string_length-source -->
178
-
179
- </div>
180
-
181
-
182
-
183
-
184
- </div><!-- string_length-method -->
185
172
 
173
+ </div>
174
+ </div>
175
+ <div class="tags">
176
+
177
+
178
+ </div><table class="source_code">
179
+ <tr>
180
+ <td>
181
+ <pre class="lines">
182
+
183
+
184
+ 9
185
+ 10
186
+ 11
187
+ 12
188
+ 13</pre>
189
+ </td>
190
+ <td>
191
+ <pre class="code"><span class="info file"># File 'lib/shenanigans/fixnum/string_length.rb', line 9</span>
192
+
193
+ <span class='kw'>def</span> <span class='id identifier rubyid_string_length'>string_length</span>
194
+ <span class='kw'>return</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
195
+ <span class='id identifier rubyid_len'>len</span> <span class='op'>=</span> <span class='const'>Math</span><span class='period'>.</span><span class='id identifier rubyid_log10'>log10</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_abs'>abs</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span>
196
+ <span class='kw'>self</span> <span class='op'>&gt;</span> <span class='int'>0</span> <span class='op'>?</span> <span class='id identifier rubyid_len'>len</span> <span class='op'>:</span> <span class='id identifier rubyid_len'>len</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span>
197
+ <span class='kw'>end</span></pre>
198
+ </td>
199
+ </tr>
200
+ </table>
201
+ </div>
186
202
 
187
- </section><!-- public-instance-method-details -->
188
-
189
- </section><!-- 5Buntitled-5D -->
190
-
191
- </div><!-- documentation -->
203
+ </div>
192
204
 
205
+ </div>
193
206
 
194
- <footer id="validator-badges">
195
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
196
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
197
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
198
- </footer>
207
+ <div id="footer">
208
+ Generated on Tue Dec 31 15:41:29 2013 by
209
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
210
+ 0.8.7.3 (ruby-2.0.0).
211
+ </div>
199
212
 
213
+ </body>
214
+ </html>
data/doc/Hash.html CHANGED
@@ -1,166 +1,215 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Hash
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
6
12
 
7
- <title>class Hash - Shenanigans</title>
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
8
14
 
9
- <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
10
16
 
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "./";
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
13
21
  </script>
14
22
 
15
- <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
-
22
23
 
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="./index.html">Home</a>
28
- <a href="./table_of_contents.html#classes">Classes</a>
29
- <a href="./table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
32
25
 
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
33
27
 
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
28
 
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (H)</a> &raquo;
35
+
36
+
37
+ <span class="title">Hash</span>
38
+
44
39
 
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
45
42
 
43
+ <div id="search">
46
44
 
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
47
63
 
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/shenanigans/hash/extract.rb
53
- <li>lib/shenanigans/hash/has_shape_pred.rb
54
- <li>lib/shenanigans/hash/to_ostruct.rb
55
- </ul>
56
- </nav>
64
+ <iframe id="search_frame"></iframe>
57
65
 
58
-
59
- </div>
66
+ <div id="content"><h1>Class: Hash
67
+
68
+
69
+
70
+ </h1>
60
71
 
61
- <div id="class-metadata">
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName"><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></span>
77
+
78
+ <ul class="fullTree">
79
+ <li><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></li>
80
+
81
+ <li class="next">Hash</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
62
87
 
63
- <nav id="parent-class-section" class="section">
64
- <h3 class="section-header">Parent</h3>
65
88
 
66
- <p class="link"><a href="Object.html">Object</a>
67
89
 
68
- </nav>
69
-
70
90
 
91
+
71
92
 
72
- <!-- Method Quickref -->
73
- <nav id="method-list-section" class="section">
74
- <h3 class="section-header">Methods</h3>
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/shenanigans/hash/extract.rb<span class="defines">,<br />
98
+ lib/shenanigans/hash/to_ostruct.rb,<br /> lib/shenanigans/hash/has_shape_pred.rb</span>
99
+ </dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
75
103
 
76
- <ul class="link-list">
77
-
78
- <li ><a href="#method-i-extract">#extract</a>
79
-
80
- <li ><a href="#method-i-has_shape-3F">#has_shape?</a>
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+ <h2>
113
+ Instance Method Summary
114
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
115
+ </h2>
116
+
117
+ <ul class="summary">
118
+
119
+ <li class="public ">
120
+ <span class="summary_signature">
81
121
 
82
- <li ><a href="#method-i-to_ostruct">#to_ostruct</a>
122
+ <a href="#extract-instance_method" title="#extract (instance method)">- (Object) <strong>extract</strong>(*ks) </a>
83
123
 
84
- </ul>
85
- </nav>
86
-
87
- </div>
88
124
 
89
- <div id="project-metadata">
90
- <nav id="fileindex-section" class="section project-section">
91
- <h3 class="section-header">Pages</h3>
125
+
126
+ </span>
127
+
128
+
129
+
130
+
131
+
132
+
133
+
92
134
 
93
- <ul>
94
135
 
95
- <li class="file"><a href="./README_rdoc.html">README</a>
136
+ <span class="summary_desc"><div class='inline'>
137
+ <p>Returns a new hash only with the specified keys (if present).</p>
138
+ </div></span>
96
139
 
97
- </ul>
98
- </nav>
140
+ </li>
99
141
 
100
- <nav id="classindex-section" class="section project-section">
101
- <h3 class="section-header">Class and Module Index</h3>
142
+
143
+ <li class="public ">
144
+ <span class="summary_signature">
145
+
146
+ <a href="#has_shape%3F-instance_method" title="#has_shape? (instance method)">- (Boolean) <strong>has_shape?</strong>(shape) </a>
147
+
102
148
 
103
- <ul class="link-list">
104
-
105
- <li><a href="./Array.html">Array</a>
149
+
150
+ </span>
106
151
 
107
- <li><a href="./Fixnum.html">Fixnum</a>
108
152
 
109
- <li><a href="./Hash.html">Hash</a>
110
153
 
111
- <li><a href="./Kernel.html">Kernel</a>
112
154
 
113
- <li><a href="./Module.html">Module</a>
114
155
 
115
- <li><a href="./Object.html">Object</a>
116
156
 
117
- <li><a href="./String.html">String</a>
118
157
 
119
- </ul>
120
- </nav>
121
158
 
122
- </div>
123
- </nav>
159
+
160
+ <span class="summary_desc"><div class='inline'>
161
+ <p>Checks if a hash has a certain structure.</p>
162
+ </div></span>
163
+
164
+ </li>
124
165
 
125
- <div id="documentation">
126
- <h1 class="class">class Hash</h1>
166
+
167
+ <li class="public ">
168
+ <span class="summary_signature">
169
+
170
+ <a href="#to_ostruct-instance_method" title="#to_ostruct (instance method)">- (Object) <strong>to_ostruct</strong> </a>
171
+
127
172
 
128
- <div id="description" class="description">
129
173
 
130
- </div><!-- description -->
174
+ </span>
175
+
176
+
177
+
178
+
179
+
180
+
181
+
131
182
 
132
183
 
184
+ <span class="summary_desc"><div class='inline'>
185
+ <p>Recursively converts a Hash and all nested Hashes to OpenStructs.</p>
186
+ </div></span>
133
187
 
188
+ </li>
189
+
190
+
191
+ </ul>
134
192
 
135
- <section id="5Buntitled-5D" class="documentation-section">
136
-
137
193
 
138
-
139
194
 
140
-
141
195
 
142
-
196
+ <div id="instance_method_details" class="method_details_list">
197
+ <h2>Instance Method Details</h2>
143
198
 
144
- <!-- Methods -->
145
199
 
146
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
147
- <h3 class="section-header">Public Instance Methods</h3>
200
+ <div class="method_details first">
201
+ <h3 class="signature first" id="extract-instance_method">
202
+
203
+ - (<tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>) <strong>extract</strong>(*ks)
204
+
148
205
 
149
-
150
- <div id="method-i-extract" class="method-detail ">
151
-
152
- <div class="method-heading">
153
- <span class="method-name">extract</span><span
154
- class="method-args">(*ks)</span>
155
-
156
- <span class="method-click-advice">click to toggle source</span>
157
-
158
- </div>
159
-
206
+
160
207
 
161
- <div class="method-description">
162
-
163
- <p>Returns a new hash only with the specified keys (if present).</p>
208
+
209
+ </h3><div class="docstring">
210
+ <div class="discussion">
211
+
212
+ <p>Returns a new hash only with the specified keys (if present).</p>
164
213
 
165
214
  <pre class="ruby"><span class="ruby-identifier">hash</span> = { <span class="ruby-identifier">a</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">:</span> <span class="ruby-value">2</span>, <span class="ruby-identifier">c</span><span class="ruby-operator">:</span> <span class="ruby-value">3</span> }
166
215
  <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">extract</span>(:<span class="ruby-identifier">b</span>, :<span class="ruby-identifier">a</span>)
@@ -168,40 +217,49 @@
168
217
  <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">extract</span>(:<span class="ruby-identifier">a</span>, :<span class="ruby-identifier">d</span>)
169
218
  <span class="ruby-comment">#=&gt; { a: 1}</span>
170
219
  </pre>
171
-
172
-
173
-
174
-
175
- <div class="method-source-code" id="extract-source">
176
- <pre><span class="ruby-comment"># File lib/shenanigans/hash/extract.rb, line 8</span>
177
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">extract</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ks</span>)
178
- <span class="ruby-identifier">existing</span> = <span class="ruby-identifier">keys</span> <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">ks</span>
179
- <span class="ruby-constant">Hash</span>[<span class="ruby-identifier">existing</span>.<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">values_at</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">existing</span>))]
180
- <span class="ruby-keyword">end</span></pre>
181
- </div><!-- extract-source -->
182
-
183
- </div>
184
220
 
185
-
186
221
 
187
-
188
- </div><!-- extract-method -->
222
+ </div>
223
+ </div>
224
+ <div class="tags">
225
+
189
226
 
227
+ </div><table class="source_code">
228
+ <tr>
229
+ <td>
230
+ <pre class="lines">
231
+
232
+
233
+ 8
234
+ 9
235
+ 10
236
+ 11</pre>
237
+ </td>
238
+ <td>
239
+ <pre class="code"><span class="info file"># File 'lib/shenanigans/hash/extract.rb', line 8</span>
240
+
241
+ <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
+ <span class='id identifier rubyid_existing'>existing</span> <span class='op'>=</span> <span class='id identifier rubyid_keys'>keys</span> <span class='op'>&amp;</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='kw'>end</span></pre>
245
+ </td>
246
+ </tr>
247
+ </table>
248
+ </div>
190
249
 
191
- <div id="method-i-has_shape-3F" class="method-detail ">
192
-
193
- <div class="method-heading">
194
- <span class="method-name">has_shape?</span><span
195
- class="method-args">(shape)</span>
196
-
197
- <span class="method-click-advice">click to toggle source</span>
198
-
199
- </div>
200
-
250
+ <div class="method_details ">
251
+ <h3 class="signature " id="has_shape?-instance_method">
252
+
253
+ - (<tt>Boolean</tt>) <strong>has_shape?</strong>(shape)
254
+
201
255
 
202
- <div class="method-description">
203
-
204
- <p>Checks if a hash has a certain structure.</p>
256
+
257
+
258
+
259
+ </h3><div class="docstring">
260
+ <div class="discussion">
261
+
262
+ <p>Checks if a hash has a certain structure.</p>
205
263
 
206
264
  <pre class="ruby"><span class="ruby-identifier">h</span> = { <span class="ruby-identifier">k1</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">k2</span><span class="ruby-operator">:</span> <span class="ruby-string">&quot;1&quot;</span> }
207
265
  <span class="ruby-identifier">h</span>.<span class="ruby-identifier">has_shape?</span>(<span class="ruby-identifier">k1</span><span class="ruby-operator">:</span> <span class="ruby-constant">Fixnum</span>, <span class="ruby-identifier">k2</span><span class="ruby-operator">:</span> <span class="ruby-constant">String</span>)
@@ -217,41 +275,64 @@
217
275
  <span class="ruby-identifier">h</span>.<span class="ruby-identifier">has_shape?</span>(<span class="ruby-identifier">shape</span>)
218
276
  <span class="ruby-comment">#=&gt; true</span>
219
277
  </pre>
220
-
221
-
222
278
 
223
-
224
- <div class="method-source-code" id="has_shape-3F-source">
225
- <pre><span class="ruby-comment"># File lib/shenanigans/hash/has_shape_pred.rb, line 13</span>
226
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">has_shape?</span>(<span class="ruby-identifier">shape</span>)
227
- <span class="ruby-identifier">all?</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
228
- <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">has_shape?</span>(<span class="ruby-identifier">shape</span>[<span class="ruby-identifier">k</span>]) <span class="ruby-operator">:</span> <span class="ruby-identifier">shape</span>[<span class="ruby-identifier">k</span>] <span class="ruby-operator">===</span> <span class="ruby-identifier">v</span>
229
- <span class="ruby-keyword">end</span>
230
- <span class="ruby-keyword">end</span></pre>
231
- </div><!-- has_shape-3F-source -->
232
-
233
- </div>
234
279
 
235
-
280
+ </div>
281
+ </div>
282
+ <div class="tags">
283
+
284
+ <p class="tag_title">Returns:</p>
285
+ <ul class="return">
286
+
287
+ <li>
288
+
289
+
290
+ <span class='type'>(<tt>Boolean</tt>)</span>
291
+
292
+
293
+
294
+ </li>
295
+
296
+ </ul>
297
+
298
+ </div><table class="source_code">
299
+ <tr>
300
+ <td>
301
+ <pre class="lines">
302
+
303
+
304
+ 13
305
+ 14
306
+ 15
307
+ 16
308
+ 17</pre>
309
+ </td>
310
+ <td>
311
+ <pre class="code"><span class="info file"># File 'lib/shenanigans/hash/has_shape_pred.rb', line 13</span>
312
+
313
+ <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
+ <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='kw'>end</span>
317
+ <span class='kw'>end</span></pre>
318
+ </td>
319
+ </tr>
320
+ </table>
321
+ </div>
322
+
323
+ <div class="method_details ">
324
+ <h3 class="signature " id="to_ostruct-instance_method">
325
+
326
+ - (<tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>) <strong>to_ostruct</strong>
327
+
236
328
 
237
-
238
- </div><!-- has_shape-3F-method -->
329
+
239
330
 
331
+
332
+ </h3><div class="docstring">
333
+ <div class="discussion">
240
334
 
241
- <div id="method-i-to_ostruct" class="method-detail ">
242
-
243
- <div class="method-heading">
244
- <span class="method-name">to_ostruct</span><span
245
- class="method-args">()</span>
246
-
247
- <span class="method-click-advice">click to toggle source</span>
248
-
249
- </div>
250
-
251
-
252
- <div class="method-description">
253
-
254
- <p>Recursively converts a <code>Hash</code> and all nested <code>Hash</code>es
335
+ <p>Recursively converts a <code>Hash</code> and all nested <code>Hash</code>es
255
336
  to <code>OpenStruct</code>s. Especially useful for parsing YAML.</p>
256
337
 
257
338
  <pre class="ruby"><span class="ruby-identifier">yaml</span>=<span class="ruby-value">&lt;&lt;EOY
@@ -272,45 +353,63 @@ EOY</span>
272
353
  <span class="ruby-identifier">struct</span>.<span class="ruby-identifier">languages</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">creator</span>
273
354
  <span class="ruby-comment">#=&gt; &quot;Matz&quot;</span>
274
355
  </pre>
275
-
276
-
277
-
278
-
279
- <div class="method-source-code" id="to_ostruct-source">
280
- <pre><span class="ruby-comment"># File lib/shenanigans/hash/to_ostruct.rb, line 23</span>
281
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">to_ostruct</span>
282
- <span class="ruby-identifier">arr</span> = <span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
283
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">v</span>
284
- <span class="ruby-keyword">when</span> <span class="ruby-constant">Hash</span>
285
- [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_ostruct</span>]
286
- <span class="ruby-keyword">when</span> <span class="ruby-constant">Array</span>
287
- [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">el</span><span class="ruby-operator">|</span> <span class="ruby-identifier">el</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_ostruct</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">el</span>.<span class="ruby-identifier">to_ostruct</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">el</span> }]
288
- <span class="ruby-keyword">else</span>
289
- [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>]
290
- <span class="ruby-keyword">end</span>
291
- <span class="ruby-keyword">end</span>
292
- <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Hash</span>[<span class="ruby-identifier">arr</span>])
293
- <span class="ruby-keyword">end</span></pre>
294
- </div><!-- to_ostruct-source -->
295
-
296
- </div>
297
356
 
298
-
299
357
 
300
-
301
- </div><!-- to_ostruct-method -->
302
-
303
-
304
- </section><!-- public-instance-method-details -->
358
+ </div>
359
+ </div>
360
+ <div class="tags">
305
361
 
306
- </section><!-- 5Buntitled-5D -->
307
362
 
308
- </div><!-- documentation -->
363
+ </div><table class="source_code">
364
+ <tr>
365
+ <td>
366
+ <pre class="lines">
367
+
368
+
369
+ 23
370
+ 24
371
+ 25
372
+ 26
373
+ 27
374
+ 28
375
+ 29
376
+ 30
377
+ 31
378
+ 32
379
+ 33
380
+ 34
381
+ 35</pre>
382
+ </td>
383
+ <td>
384
+ <pre class="code"><span class="info file"># File 'lib/shenanigans/hash/to_ostruct.rb', line 23</span>
385
+
386
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_ostruct'>to_ostruct</span>
387
+ <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
+ <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='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='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
+ <span class='kw'>else</span>
394
+ <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
+ <span class='kw'>end</span>
396
+ <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='kw'>end</span></pre>
399
+ </td>
400
+ </tr>
401
+ </table>
402
+ </div>
403
+
404
+ </div>
309
405
 
406
+ </div>
310
407
 
311
- <footer id="validator-badges">
312
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
313
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
314
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
315
- </footer>
408
+ <div id="footer">
409
+ Generated on Tue Dec 31 15:41:29 2013 by
410
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
411
+ 0.8.7.3 (ruby-2.0.0).
412
+ </div>
316
413
 
414
+ </body>
415
+ </html>