mack-facets 0.6.1.1 → 0.6.1.2

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 +408 -0
  2. data/doc/classes/Class.html +233 -0
  3. data/doc/classes/Hash.html +233 -0
  4. data/doc/classes/Kernel.html +184 -0
  5. data/doc/classes/Mack/Utils/Inflector.html +382 -0
  6. data/doc/classes/Mack/Utils/RegistryList.html +469 -0
  7. data/doc/classes/Mack/Utils/RegistryMap.html +479 -0
  8. data/doc/classes/Math.html +188 -0
  9. data/doc/classes/Module.html +203 -0
  10. data/doc/classes/NilClass.html +148 -0
  11. data/doc/classes/Object.html +558 -0
  12. data/doc/classes/String.html +451 -0
  13. data/doc/classes/Symbol.html +148 -0
  14. data/doc/created.rid +1 -0
  15. data/doc/files/README.html +112 -0
  16. data/doc/files/lib/mack-facets/english_extensions/inflect_rb.html +101 -0
  17. data/doc/files/lib/mack-facets/english_extensions/numerals_rb.html +101 -0
  18. data/doc/files/lib/mack-facets/extensions/array_rb.html +101 -0
  19. data/doc/files/lib/mack-facets/extensions/class_rb.html +101 -0
  20. data/doc/files/lib/mack-facets/extensions/hash_rb.html +108 -0
  21. data/doc/files/lib/mack-facets/extensions/kernel_rb.html +109 -0
  22. data/doc/files/lib/mack-facets/extensions/math_rb.html +101 -0
  23. data/doc/files/lib/mack-facets/extensions/module_rb.html +101 -0
  24. data/doc/files/lib/mack-facets/extensions/nil_class_rb.html +101 -0
  25. data/doc/files/lib/mack-facets/extensions/object_rb.html +101 -0
  26. data/doc/files/lib/mack-facets/extensions/string_rb.html +101 -0
  27. data/doc/files/lib/mack-facets/extensions/symbol_rb.html +101 -0
  28. data/doc/files/lib/mack-facets/utils/inflections_rb.html +101 -0
  29. data/doc/files/lib/mack-facets/utils/inflector_rb.html +108 -0
  30. data/doc/files/lib/mack-facets/utils/options_merger_rb.html +101 -0
  31. data/doc/files/lib/mack-facets/utils/registry_list_rb.html +108 -0
  32. data/doc/files/lib/mack-facets/utils/registry_map_rb.html +108 -0
  33. data/doc/files/lib/mack-facets_rb.html +123 -0
  34. data/doc/fr_class_index.html +39 -0
  35. data/doc/fr_file_index.html +45 -0
  36. data/doc/fr_method_index.html +98 -0
  37. data/doc/index.html +24 -0
  38. data/doc/rdoc-style.css +208 -0
  39. metadata +40 -2
@@ -0,0 +1,451 @@
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: String</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">String</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/mack-facets/extensions/string_rb.html">
59
+ lib/mack-facets/extensions/string.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="#M000032">constantize</a>&nbsp;&nbsp;
92
+ <a href="#M000033">hexdigest</a>&nbsp;&nbsp;
93
+ <a href="#M000034">hexdigest!</a>&nbsp;&nbsp;
94
+ <a href="#M000031">methodize</a>&nbsp;&nbsp;
95
+ <a href="#M000035">randomize</a>&nbsp;&nbsp;
96
+ <a href="#M000038">truncate</a>&nbsp;&nbsp;
97
+ <a href="#M000039">truncate!</a>&nbsp;&nbsp;
98
+ <a href="#M000036">uri_escape</a>&nbsp;&nbsp;
99
+ <a href="#M000037">uri_unescape</a>&nbsp;&nbsp;
100
+ </div>
101
+ </div>
102
+
103
+ </div>
104
+
105
+
106
+ <!-- if includes -->
107
+ <div id="includes">
108
+ <h3 class="section-bar">Included Modules</h3>
109
+
110
+ <div id="includes-list">
111
+ <span class="include-name">Style</span>
112
+ </div>
113
+ </div>
114
+
115
+ <div id="section">
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <!-- if method_list -->
125
+ <div id="methods">
126
+ <h3 class="section-bar">Public Class methods</h3>
127
+
128
+ <div id="method-M000035" class="method-detail">
129
+ <a name="M000035"></a>
130
+
131
+ <div class="method-heading">
132
+ <a href="#M000035" class="method-signature">
133
+ <span class="method-name">randomize</span><span class="method-args">(length = 10)</span>
134
+ </a>
135
+ </div>
136
+
137
+ <div class="method-description">
138
+ <p><a class="source-toggle" href="#"
139
+ onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
140
+ <div class="method-source-code" id="M000035-source">
141
+ <pre>
142
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 95</span>
143
+ 95: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">randomize</span>(<span class="ruby-identifier">length</span> = <span class="ruby-value">10</span>)
144
+ 96: <span class="ruby-identifier">chars</span> = (<span class="ruby-value str">&quot;A&quot;</span><span class="ruby-operator">..</span><span class="ruby-value str">&quot;H&quot;</span>).<span class="ruby-identifier">to_a</span> <span class="ruby-operator">+</span> (<span class="ruby-value str">&quot;J&quot;</span><span class="ruby-operator">..</span><span class="ruby-value str">&quot;N&quot;</span>).<span class="ruby-identifier">to_a</span> <span class="ruby-operator">+</span> (<span class="ruby-value str">&quot;P&quot;</span><span class="ruby-operator">..</span><span class="ruby-value str">&quot;T&quot;</span>).<span class="ruby-identifier">to_a</span> <span class="ruby-operator">+</span> (<span class="ruby-value str">&quot;W&quot;</span><span class="ruby-operator">..</span><span class="ruby-value str">&quot;Z&quot;</span>).<span class="ruby-identifier">to_a</span> <span class="ruby-operator">+</span> (<span class="ruby-value str">&quot;3&quot;</span><span class="ruby-operator">..</span><span class="ruby-value str">&quot;9&quot;</span>).<span class="ruby-identifier">to_a</span>
145
+ 97: <span class="ruby-identifier">newpass</span> = <span class="ruby-value str">&quot;&quot;</span>
146
+ 98: <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">length</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">newpass</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">chars</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">chars</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)] }
147
+ 99: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">newpass</span>.<span class="ruby-identifier">upcase</span>
148
+ 100: <span class="ruby-keyword kw">end</span>
149
+ </pre>
150
+ </div>
151
+ </div>
152
+ </div>
153
+
154
+ <h3 class="section-bar">Public Instance methods</h3>
155
+
156
+ <div id="method-M000032" class="method-detail">
157
+ <a name="M000032"></a>
158
+
159
+ <div class="method-heading">
160
+ <a href="#M000032" class="method-signature">
161
+ <span class="method-name">constantize</span><span class="method-args">()</span>
162
+ </a>
163
+ </div>
164
+
165
+ <div class="method-description">
166
+ <p>
167
+ Returns a constant of the string.
168
+ </p>
169
+ <p>
170
+ Examples:
171
+ </p>
172
+ <pre>
173
+ &quot;User&quot;.constantize # =&gt; User
174
+ &quot;HomeController&quot;.constantize # =&gt; HomeController
175
+ &quot;Mack::Configuration&quot; # =&gt; Mack::Configuration
176
+ </pre>
177
+ <p><a class="source-toggle" href="#"
178
+ onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
179
+ <div class="method-source-code" id="M000032-source">
180
+ <pre>
181
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 83</span>
182
+ 83: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">constantize</span>
183
+ 84: <span class="ruby-constant">Module</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-node">&quot;::#{self}&quot;</span>)
184
+ 85: <span class="ruby-keyword kw">end</span>
185
+ </pre>
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+ <div id="method-M000033" class="method-detail">
191
+ <a name="M000033"></a>
192
+
193
+ <div class="method-heading">
194
+ <a href="#M000033" class="method-signature">
195
+ <span class="method-name">hexdigest</span><span class="method-args">()</span>
196
+ </a>
197
+ </div>
198
+
199
+ <div class="method-description">
200
+ <p><a class="source-toggle" href="#"
201
+ onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
202
+ <div class="method-source-code" id="M000033-source">
203
+ <pre>
204
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 87</span>
205
+ 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hexdigest</span>
206
+ 88: <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA1</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-keyword kw">self</span>)
207
+ 89: <span class="ruby-keyword kw">end</span>
208
+ </pre>
209
+ </div>
210
+ </div>
211
+ </div>
212
+
213
+ <div id="method-M000034" class="method-detail">
214
+ <a name="M000034"></a>
215
+
216
+ <div class="method-heading">
217
+ <a href="#M000034" class="method-signature">
218
+ <span class="method-name">hexdigest!</span><span class="method-args">()</span>
219
+ </a>
220
+ </div>
221
+
222
+ <div class="method-description">
223
+ <p><a class="source-toggle" href="#"
224
+ onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
225
+ <div class="method-source-code" id="M000034-source">
226
+ <pre>
227
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 91</span>
228
+ 91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hexdigest!</span>
229
+ 92: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">hexdigest</span>)
230
+ 93: <span class="ruby-keyword kw">end</span>
231
+ </pre>
232
+ </div>
233
+ </div>
234
+ </div>
235
+
236
+ <div id="method-M000031" class="method-detail">
237
+ <a name="M000031"></a>
238
+
239
+ <div class="method-heading">
240
+ <a href="#M000031" class="method-signature">
241
+ <span class="method-name">methodize</span><span class="method-args">()</span>
242
+ </a>
243
+ </div>
244
+
245
+ <div class="method-description">
246
+ <p><a class="source-toggle" href="#"
247
+ onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
248
+ <div class="method-source-code" id="M000031-source">
249
+ <pre>
250
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 4</span>
251
+ 4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">methodize</span>
252
+ 5: <span class="ruby-identifier">x</span> = <span class="ruby-keyword kw">self</span>
253
+ 6:
254
+ 7: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
255
+ 8: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{self} cannot be converted to a valid method name!&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span>
256
+ 9:
257
+ 10: <span class="ruby-comment cmt"># get rid of the big stuff in the front/back</span>
258
+ 11: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">strip!</span>
259
+ 12:
260
+ 13: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
261
+ 14: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{self} cannot be converted to a valid method name!&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span>
262
+ 15:
263
+ 16: <span class="ruby-identifier">x</span> = <span class="ruby-identifier">x</span>.<span class="ruby-identifier">underscore</span>
264
+ 17:
265
+ 18: <span class="ruby-comment cmt"># get rid of spaces and make the _</span>
266
+ 19: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'_'</span>)
267
+ 20: <span class="ruby-comment cmt"># get rid of everything that isn't 'safe' a-z, 0-9, ?, !, =, _</span>
268
+ 21: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/([^ a-zA-Z0-9\_\?\!\=]+)/n</span>, <span class="ruby-value str">'_'</span>)
269
+ 22:
270
+ 23: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
271
+ 24: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{self} cannot be converted to a valid method name!&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span>
272
+ 25:
273
+ 26: <span class="ruby-comment cmt"># condense multiple 'safe' non a-z chars to just one.</span>
274
+ 27: <span class="ruby-comment cmt"># ie. ___ becomes _ !!!! becomes ! etc...</span>
275
+ 28: [<span class="ruby-value str">' '</span>, <span class="ruby-value str">'_'</span>, <span class="ruby-value str">'?'</span>, <span class="ruby-value str">'!'</span>, <span class="ruby-value str">&quot;=&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
276
+ 29: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">squeeze!</span>(<span class="ruby-identifier">c</span>)
277
+ 30: <span class="ruby-keyword kw">end</span>
278
+ 31:
279
+ 32: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
280
+ 33: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{self} cannot be converted to a valid method name!&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span>
281
+ 34:
282
+ 35: <span class="ruby-comment cmt">#down case the whole thing</span>
283
+ 36: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">downcase!</span>
284
+ 37:
285
+ 38: <span class="ruby-comment cmt"># get rid of any characters at the beginning that aren't a-z</span>
286
+ 39: <span class="ruby-keyword kw">while</span> <span class="ruby-operator">!</span><span class="ruby-identifier">x</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^[a-z]/</span>)
287
+ 40: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
288
+ 41:
289
+ 42: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
290
+ 43: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{self} cannot be converted to a valid method name!&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span>
291
+ 44: <span class="ruby-keyword kw">end</span>
292
+ 45:
293
+ 46: <span class="ruby-comment cmt"># let's trim this bad boy down a bit now that we've cleaned it up, somewhat.</span>
294
+ 47: <span class="ruby-comment cmt"># we should do this before cleaning up the end character, because it's possible to end up with a </span>
295
+ 48: <span class="ruby-comment cmt"># bad char at the end if you trim too late.</span>
296
+ 49: <span class="ruby-identifier">x</span> = <span class="ruby-identifier">x</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">100</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">100</span>
297
+ 50:
298
+ 51: <span class="ruby-comment cmt"># get rid of any characters at the end that aren't safe</span>
299
+ 52: <span class="ruby-keyword kw">while</span> <span class="ruby-operator">!</span><span class="ruby-identifier">x</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/[a-z0-9\?\!\=]$/</span>)
300
+ 53: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-identifier">x</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
301
+ 54: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
302
+ 55: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{self} cannot be converted to a valid method name!&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span>
303
+ 56: <span class="ruby-keyword kw">end</span>
304
+ 57:
305
+ 58: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
306
+ 59: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{self} cannot be converted to a valid method name!&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span>
307
+ 60:
308
+ 61: <span class="ruby-comment cmt"># let's get rid of characters that don't belong in the 'middle' of the method.</span>
309
+ 62: <span class="ruby-identifier">orig_middle</span> = <span class="ruby-identifier">x</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">x</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>)]
310
+ 63: <span class="ruby-identifier">n_middle</span> = <span class="ruby-identifier">orig_middle</span>.<span class="ruby-identifier">dup</span>
311
+ 64:
312
+ 65: [<span class="ruby-value str">'?'</span>, <span class="ruby-value str">'!'</span>, <span class="ruby-value str">&quot;=&quot;</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
313
+ 66: <span class="ruby-identifier">n_middle</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">c</span>, <span class="ruby-value str">&quot;_&quot;</span>)
314
+ 67: <span class="ruby-keyword kw">end</span>
315
+ 68:
316
+ 69: <span class="ruby-comment cmt"># the previous gsub can leave us with multiple underscores that need cleaning up.</span>
317
+ 70: <span class="ruby-identifier">n_middle</span>.<span class="ruby-identifier">squeeze!</span>(<span class="ruby-value str">&quot;_&quot;</span>)
318
+ 71:
319
+ 72: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">orig_middle</span>, <span class="ruby-identifier">n_middle</span>)
320
+ 73: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">&quot;_=&quot;</span>, <span class="ruby-value str">&quot;=&quot;</span>)
321
+ 74: <span class="ruby-identifier">x</span>
322
+ 75: <span class="ruby-keyword kw">end</span>
323
+ </pre>
324
+ </div>
325
+ </div>
326
+ </div>
327
+
328
+ <div id="method-M000038" class="method-detail">
329
+ <a name="M000038"></a>
330
+
331
+ <div class="method-heading">
332
+ <a href="#M000038" class="method-signature">
333
+ <span class="method-name">truncate</span><span class="method-args">(length = 30, truncate_string = &quot;...&quot;)</span>
334
+ </a>
335
+ </div>
336
+
337
+ <div class="method-description">
338
+ <p><a class="source-toggle" href="#"
339
+ onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
340
+ <div class="method-source-code" id="M000038-source">
341
+ <pre>
342
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 118</span>
343
+ 118: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">truncate</span>(<span class="ruby-identifier">length</span> = <span class="ruby-value">30</span>, <span class="ruby-identifier">truncate_string</span> = <span class="ruby-value str">&quot;...&quot;</span>)
344
+ 119: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">end</span>
345
+ 120: <span class="ruby-identifier">l</span> = <span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">truncate_string</span>.<span class="ruby-identifier">length</span>
346
+ 121: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$KCODE</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;NONE&quot;</span>
347
+ 122: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">length</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">l</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">truncate_string</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>
348
+ 123: <span class="ruby-keyword kw">else</span>
349
+ 124: <span class="ruby-identifier">chars</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>)
350
+ 125: <span class="ruby-identifier">chars</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">length</span> <span class="ruby-value">? </span><span class="ruby-identifier">chars</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">l</span>].<span class="ruby-identifier">join</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">truncate_string</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>
351
+ 126: <span class="ruby-keyword kw">end</span>
352
+ 127: <span class="ruby-keyword kw">end</span>
353
+ </pre>
354
+ </div>
355
+ </div>
356
+ </div>
357
+
358
+ <div id="method-M000039" class="method-detail">
359
+ <a name="M000039"></a>
360
+
361
+ <div class="method-heading">
362
+ <a href="#M000039" class="method-signature">
363
+ <span class="method-name">truncate!</span><span class="method-args">(length = 30, truncate_string = &quot;...&quot;)</span>
364
+ </a>
365
+ </div>
366
+
367
+ <div class="method-description">
368
+ <p><a class="source-toggle" href="#"
369
+ onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
370
+ <div class="method-source-code" id="M000039-source">
371
+ <pre>
372
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 129</span>
373
+ 129: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">truncate!</span>(<span class="ruby-identifier">length</span> = <span class="ruby-value">30</span>, <span class="ruby-identifier">truncate_string</span> = <span class="ruby-value str">&quot;...&quot;</span>)
374
+ 130: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">truncate</span>(<span class="ruby-identifier">length</span>, <span class="ruby-identifier">truncate_string</span>))
375
+ 131: <span class="ruby-keyword kw">end</span>
376
+ </pre>
377
+ </div>
378
+ </div>
379
+ </div>
380
+
381
+ <div id="method-M000036" class="method-detail">
382
+ <a name="M000036"></a>
383
+
384
+ <div class="method-heading">
385
+ <a href="#M000036" class="method-signature">
386
+ <span class="method-name">uri_escape</span><span class="method-args">()</span>
387
+ </a>
388
+ </div>
389
+
390
+ <div class="method-description">
391
+ <p>
392
+ Performs URI escaping so that you can construct proper query strings
393
+ faster. Use this rather than the cgi.rb version since it&#8216;s faster.
394
+ (Stolen from Camping).
395
+ </p>
396
+ <p><a class="source-toggle" href="#"
397
+ onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
398
+ <div class="method-source-code" id="M000036-source">
399
+ <pre>
400
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 105</span>
401
+ 105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uri_escape</span>
402
+ 106: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([^ a-zA-Z0-9_.-]+)/n</span>) {
403
+ 107: <span class="ruby-value str">'%'</span><span class="ruby-operator">+</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'H2'</span><span class="ruby-operator">*</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">size</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'%'</span>).<span class="ruby-identifier">upcase</span>
404
+ 108: }.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'+'</span>)
405
+ 109: <span class="ruby-keyword kw">end</span>
406
+ </pre>
407
+ </div>
408
+ </div>
409
+ </div>
410
+
411
+ <div id="method-M000037" class="method-detail">
412
+ <a name="M000037"></a>
413
+
414
+ <div class="method-heading">
415
+ <a href="#M000037" class="method-signature">
416
+ <span class="method-name">uri_unescape</span><span class="method-args">()</span>
417
+ </a>
418
+ </div>
419
+
420
+ <div class="method-description">
421
+ <p>
422
+ Unescapes a URI escaped string. (Stolen from Camping).
423
+ </p>
424
+ <p><a class="source-toggle" href="#"
425
+ onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
426
+ <div class="method-source-code" id="M000037-source">
427
+ <pre>
428
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/string.rb, line 112</span>
429
+ 112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uri_unescape</span>
430
+ 113: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">'+'</span>, <span class="ruby-value str">' '</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/((?:%[0-9a-fA-F]{2})+)/n</span>){
431
+ 114: [<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'%'</span>)].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">'H*'</span>)
432
+ 115: }
433
+ 116: <span class="ruby-keyword kw">end</span>
434
+ </pre>
435
+ </div>
436
+ </div>
437
+ </div>
438
+
439
+
440
+ </div>
441
+
442
+
443
+ </div>
444
+
445
+
446
+ <div id="validator-badges">
447
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
448
+ </div>
449
+
450
+ </body>
451
+ </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: Symbol</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">Symbol</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/mack-facets/extensions/symbol_rb.html">
59
+ lib/mack-facets/extensions/symbol.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="#M000001">methodize</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-M000001" class="method-detail">
114
+ <a name="M000001"></a>
115
+
116
+ <div class="method-heading">
117
+ <a href="#M000001" class="method-signature">
118
+ <span class="method-name">methodize</span><span class="method-args">()</span>
119
+ </a>
120
+ </div>
121
+
122
+ <div class="method-description">
123
+ <p><a class="source-toggle" href="#"
124
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
125
+ <div class="method-source-code" id="M000001-source">
126
+ <pre>
127
+ <span class="ruby-comment cmt"># File lib/mack-facets/extensions/symbol.rb, line 3</span>
128
+ 3: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">methodize</span>
129
+ 4: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">methodize</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>