mack_ruby_core_extensions 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/doc/classes/Array.html +465 -0
  2. data/doc/classes/Class.html +233 -0
  3. data/doc/classes/Float.html +148 -0
  4. data/doc/classes/Hash.html +232 -0
  5. data/doc/classes/Kernel.html +184 -0
  6. data/doc/classes/Mack/Utils/Inflector.html +422 -0
  7. data/doc/classes/Math.html +188 -0
  8. data/doc/classes/MethodNotImplemented.html +155 -0
  9. data/doc/classes/Module.html +203 -0
  10. data/doc/classes/NilClass.html +151 -0
  11. data/doc/classes/Object.html +448 -0
  12. data/doc/classes/String.html +977 -0
  13. data/doc/classes/Symbol.html +148 -0
  14. data/doc/created.rid +1 -0
  15. data/doc/files/README.html +151 -0
  16. data/doc/files/lib/extensions/array_rb.html +101 -0
  17. data/doc/files/lib/extensions/class_rb.html +101 -0
  18. data/doc/files/lib/extensions/float_rb.html +101 -0
  19. data/doc/files/lib/extensions/hash_rb.html +108 -0
  20. data/doc/files/lib/extensions/kernel_rb.html +109 -0
  21. data/doc/files/lib/extensions/math_rb.html +101 -0
  22. data/doc/files/lib/extensions/method_not_implemented_rb.html +108 -0
  23. data/doc/files/lib/extensions/module_rb.html +101 -0
  24. data/doc/files/lib/extensions/nil_rb.html +101 -0
  25. data/doc/files/lib/extensions/object_rb.html +101 -0
  26. data/doc/files/lib/extensions/string_rb.html +108 -0
  27. data/doc/files/lib/extensions/symbol_rb.html +101 -0
  28. data/doc/files/lib/mack_ruby_core_extensions_rb.html +101 -0
  29. data/doc/files/lib/utils/inflections_rb.html +101 -0
  30. data/doc/files/lib/utils/inflector_rb.html +108 -0
  31. data/doc/fr_class_index.html +39 -0
  32. data/doc/fr_file_index.html +42 -0
  33. data/doc/fr_method_index.html +96 -0
  34. data/doc/index.html +24 -0
  35. data/doc/rdoc-style.css +208 -0
  36. data/lib/extensions/class.rb +14 -0
  37. data/lib/extensions/object.rb +5 -0
  38. data/test/extensions/class_test.rb +10 -0
  39. metadata +37 -2
@@ -0,0 +1,233 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Class</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Class</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/extensions/class_rb.html">
59
+ lib/extensions/class.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000021">class_is_a?</a>&nbsp;&nbsp;
92
+ <a href="#M000020">new_instance_of</a>&nbsp;&nbsp;
93
+ <a href="#M000022">parents</a>&nbsp;&nbsp;
94
+ </div>
95
+ </div>
96
+
97
+ </div>
98
+
99
+
100
+ <!-- if includes -->
101
+
102
+ <div id="section">
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ <!-- if method_list -->
112
+ <div id="methods">
113
+ <h3 class="section-bar">Public Class methods</h3>
114
+
115
+ <div id="method-M000020" class="method-detail">
116
+ <a name="M000020"></a>
117
+
118
+ <div class="method-heading">
119
+ <a href="#M000020" class="method-signature">
120
+ <span class="method-name">new_instance_of</span><span class="method-args">(klass_name)</span>
121
+ </a>
122
+ </div>
123
+
124
+ <div class="method-description">
125
+ <p>
126
+ Returns a new <a href="Object.html">Object</a> instance of the class name
127
+ specified.
128
+ </p>
129
+ <p>
130
+ Examples:
131
+ </p>
132
+ <pre>
133
+ Class.new_instance_of(&quot;Orange&quot;) =&gt; #&lt;Orange:0x376c0c&gt;
134
+ Class.new_instance_of(&quot;Animals::Dog&quot;) =&gt; #&lt;Animals::Dog:0x376a2c&gt;
135
+ </pre>
136
+ <p><a class="source-toggle" href="#"
137
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
138
+ <div class="method-source-code" id="M000020-source">
139
+ <pre>
140
+ <span class="ruby-comment cmt"># File lib/extensions/class.rb, line 8</span>
141
+ 8: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new_instance_of</span>(<span class="ruby-identifier">klass_name</span>)
142
+ 9: <span class="ruby-identifier">klass_name</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>
143
+ 10: <span class="ruby-keyword kw">end</span>
144
+ </pre>
145
+ </div>
146
+ </div>
147
+ </div>
148
+
149
+ <h3 class="section-bar">Public Instance methods</h3>
150
+
151
+ <div id="method-M000021" class="method-detail">
152
+ <a name="M000021"></a>
153
+
154
+ <div class="method-heading">
155
+ <a href="#M000021" class="method-signature">
156
+ <span class="method-name">class_is_a?</span><span class="method-args">(klass_name)</span>
157
+ </a>
158
+ </div>
159
+
160
+ <div class="method-description">
161
+ <p>
162
+ This will through the ancestor tree of object and tell you if that object
163
+ is of the specified type.
164
+ </p>
165
+ <p><a class="source-toggle" href="#"
166
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
167
+ <div class="method-source-code" id="M000021-source">
168
+ <pre>
169
+ <span class="ruby-comment cmt"># File lib/extensions/class.rb, line 14</span>
170
+ 14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_is_a?</span>(<span class="ruby-identifier">klass_name</span>)
171
+ 15: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ancestors</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">an</span><span class="ruby-operator">|</span>
172
+ 16: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">an</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">klass_name</span>
173
+ 17: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
174
+ 18: <span class="ruby-keyword kw">end</span>
175
+ 19: <span class="ruby-keyword kw">end</span>
176
+ 20: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
177
+ 21: <span class="ruby-keyword kw">end</span>
178
+ </pre>
179
+ </div>
180
+ </div>
181
+ </div>
182
+
183
+ <div id="method-M000022" class="method-detail">
184
+ <a name="M000022"></a>
185
+
186
+ <div class="method-heading">
187
+ <a href="#M000022" class="method-signature">
188
+ <span class="method-name">parents</span><span class="method-args">()</span>
189
+ </a>
190
+ </div>
191
+
192
+ <div class="method-description">
193
+ <p>
194
+ Returns an array of the classes parent classes.
195
+ </p>
196
+ <p>
197
+ Examples:
198
+ </p>
199
+ <pre>
200
+ Orange.parents # =&gt; [Citrus, Fruit, Object]
201
+ Citrus.parents # =&gt; [Fruit, Object]
202
+ Fruit.parents # =&gt; [Object]
203
+ </pre>
204
+ <p><a class="source-toggle" href="#"
205
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
206
+ <div class="method-source-code" id="M000022-source">
207
+ <pre>
208
+ <span class="ruby-comment cmt"># File lib/extensions/class.rb, line 29</span>
209
+ 29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parents</span>
210
+ 30: <span class="ruby-identifier">ans</span> = [<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">superclass</span>]
211
+ 31: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">ans</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">superclass</span>.<span class="ruby-identifier">nil?</span>
212
+ 32: <span class="ruby-identifier">ans</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">ans</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">superclass</span>
213
+ 33: <span class="ruby-keyword kw">end</span>
214
+ 34: <span class="ruby-identifier">ans</span>
215
+ 35: <span class="ruby-keyword kw">end</span>
216
+ </pre>
217
+ </div>
218
+ </div>
219
+ </div>
220
+
221
+
222
+ </div>
223
+
224
+
225
+ </div>
226
+
227
+
228
+ <div id="validator-badges">
229
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
230
+ </div>
231
+
232
+ </body>
233
+ </html>
@@ -0,0 +1,148 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Float</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Float</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/extensions/float_rb.html">
59
+ lib/extensions/float.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000019">prec</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+ <div id="methods">
111
+ <h3 class="section-bar">Public Instance methods</h3>
112
+
113
+ <div id="method-M000019" class="method-detail">
114
+ <a name="M000019"></a>
115
+
116
+ <div class="method-heading">
117
+ <a href="#M000019" class="method-signature">
118
+ <span class="method-name">prec</span><span class="method-args">(x)</span>
119
+ </a>
120
+ </div>
121
+
122
+ <div class="method-description">
123
+ <p><a class="source-toggle" href="#"
124
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
125
+ <div class="method-source-code" id="M000019-source">
126
+ <pre>
127
+ <span class="ruby-comment cmt"># File lib/extensions/float.rb, line 3</span>
128
+ 3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prec</span>(<span class="ruby-identifier">x</span>)
129
+ 4: <span class="ruby-identifier">sprintf</span>(<span class="ruby-node">&quot;%01.#{x}f&quot;</span>, <span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">to_f</span>
130
+ 5: <span class="ruby-keyword kw">end</span>
131
+ </pre>
132
+ </div>
133
+ </div>
134
+ </div>
135
+
136
+
137
+ </div>
138
+
139
+
140
+ </div>
141
+
142
+
143
+ <div id="validator-badges">
144
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
145
+ </div>
146
+
147
+ </body>
148
+ </html>
@@ -0,0 +1,232 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Hash</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Hash</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/extensions/hash_rb.html">
59
+ lib/extensions/hash.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000003">-</a>&nbsp;&nbsp;
92
+ <a href="#M000002">join</a>&nbsp;&nbsp;
93
+ <a href="#M000004">to_params</a>&nbsp;&nbsp;
94
+ </div>
95
+ </div>
96
+
97
+ </div>
98
+
99
+
100
+ <!-- if includes -->
101
+
102
+ <div id="section">
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ <!-- if method_list -->
112
+ <div id="methods">
113
+ <h3 class="section-bar">Public Instance methods</h3>
114
+
115
+ <div id="method-M000003" class="method-detail">
116
+ <a name="M000003"></a>
117
+
118
+ <div class="method-heading">
119
+ <a href="#M000003" class="method-signature">
120
+ <span class="method-name">-</span><span class="method-args">(ars)</span>
121
+ </a>
122
+ </div>
123
+
124
+ <div class="method-description">
125
+ <p>
126
+ Deletes the key(s) passed in from the hash.
127
+ </p>
128
+ <p><a class="source-toggle" href="#"
129
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
130
+ <div class="method-source-code" id="M000003-source">
131
+ <pre>
132
+ <span class="ruby-comment cmt"># File lib/extensions/hash.rb, line 13</span>
133
+ 13: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">ars</span>)
134
+ 14: [<span class="ruby-identifier">ars</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">a</span>)}
135
+ 15: <span class="ruby-keyword kw">self</span>
136
+ 16: <span class="ruby-keyword kw">end</span>
137
+ </pre>
138
+ </div>
139
+ </div>
140
+ </div>
141
+
142
+ <div id="method-M000002" class="method-detail">
143
+ <a name="M000002"></a>
144
+
145
+ <div class="method-heading">
146
+ <a href="#M000002" class="method-signature">
147
+ <span class="method-name">join</span><span class="method-args">(pair_string, join_string)</span>
148
+ </a>
149
+ </div>
150
+
151
+ <div class="method-description">
152
+ <p><a class="source-toggle" href="#"
153
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
154
+ <div class="method-source-code" id="M000002-source">
155
+ <pre>
156
+ <span class="ruby-comment cmt"># File lib/extensions/hash.rb, line 4</span>
157
+ 4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join</span>(<span class="ruby-identifier">pair_string</span>, <span class="ruby-identifier">join_string</span>)
158
+ 5: <span class="ruby-identifier">a</span> = []
159
+ 6: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
160
+ 7: <span class="ruby-identifier">a</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-identifier">pair_string</span>, <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>)
161
+ 8: <span class="ruby-keyword kw">end</span>
162
+ 9: <span class="ruby-identifier">a</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">join_string</span>)
163
+ 10: <span class="ruby-keyword kw">end</span>
164
+ </pre>
165
+ </div>
166
+ </div>
167
+ </div>
168
+
169
+ <div id="method-M000004" class="method-detail">
170
+ <a name="M000004"></a>
171
+
172
+ <div class="method-heading">
173
+ <a href="#M000004" class="method-signature">
174
+ <span class="method-name">to_params</span><span class="method-args">(escape = true)</span>
175
+ </a>
176
+ </div>
177
+
178
+ <div class="method-description">
179
+ <p>
180
+ Converts a hash to query string parameters. An optional boolean escapes the
181
+ values if true, which is the default.
182
+ </p>
183
+ <p><a class="source-toggle" href="#"
184
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
185
+ <div class="method-source-code" id="M000004-source">
186
+ <pre>
187
+ <span class="ruby-comment cmt"># File lib/extensions/hash.rb, line 20</span>
188
+ 20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_params</span>(<span class="ruby-identifier">escape</span> = <span class="ruby-keyword kw">true</span>)
189
+ 21: <span class="ruby-identifier">params</span> = <span class="ruby-value str">''</span>
190
+ 22: <span class="ruby-identifier">stack</span> = []
191
+ 23:
192
+ 24: <span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
193
+ 25: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
194
+ 26: <span class="ruby-identifier">stack</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>]
195
+ 27: <span class="ruby-keyword kw">else</span>
196
+ 28: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">uri_escape</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">escape</span>
197
+ 29: <span class="ruby-identifier">params</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{k}=#{v}&amp;&quot;</span>
198
+ 30: <span class="ruby-keyword kw">end</span>
199
+ 31: <span class="ruby-keyword kw">end</span>
200
+ 32:
201
+ 33: <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">parent</span>, <span class="ruby-identifier">hash</span><span class="ruby-operator">|</span>
202
+ 34: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
203
+ 35: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
204
+ 36: <span class="ruby-identifier">stack</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-node">&quot;#{parent}[#{k}]&quot;</span>, <span class="ruby-identifier">v</span>]
205
+ 37: <span class="ruby-keyword kw">else</span>
206
+ 38: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">uri_escape</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">escape</span>
207
+ 39: <span class="ruby-identifier">params</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{parent}[#{k}]=#{v}&amp;&quot;</span>
208
+ 40: <span class="ruby-keyword kw">end</span>
209
+ 41: <span class="ruby-keyword kw">end</span>
210
+ 42: <span class="ruby-keyword kw">end</span>
211
+ 43:
212
+ 44: <span class="ruby-identifier">params</span>.<span class="ruby-identifier">chop!</span> <span class="ruby-comment cmt"># trailing &amp;</span>
213
+ 45: <span class="ruby-identifier">params</span>
214
+ 46: <span class="ruby-keyword kw">end</span>
215
+ </pre>
216
+ </div>
217
+ </div>
218
+ </div>
219
+
220
+
221
+ </div>
222
+
223
+
224
+ </div>
225
+
226
+
227
+ <div id="validator-badges">
228
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
229
+ </div>
230
+
231
+ </body>
232
+ </html>