mack_ruby_core_extensions 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -88,30 +88,31 @@
88
88
  <h3 class="section-bar">Methods</h3>
89
89
 
90
90
  <div class="name-list">
91
- <a href="#M000034">blank?</a>&nbsp;&nbsp;
92
- <a href="#M000045">breakify</a>&nbsp;&nbsp;
93
- <a href="#M000046">breakify!</a>&nbsp;&nbsp;
94
- <a href="#M000032">camelcase</a>&nbsp;&nbsp;
95
- <a href="#M000052">capitalize_all_words</a>&nbsp;&nbsp;
96
- <a href="#M000053">capitalize_all_words!</a>&nbsp;&nbsp;
97
- <a href="#M000033">constantize</a>&nbsp;&nbsp;
98
- <a href="#M000041">ends_with?</a>&nbsp;&nbsp;
99
- <a href="#M000047">hexdigest</a>&nbsp;&nbsp;
100
- <a href="#M000048">hexdigest!</a>&nbsp;&nbsp;
101
- <a href="#M000037">linkify</a>&nbsp;&nbsp;
102
- <a href="#M000038">methodize</a>&nbsp;&nbsp;
103
- <a href="#M000035">plural</a>&nbsp;&nbsp;
104
- <a href="#M000042">pluralize_word</a>&nbsp;&nbsp;
105
- <a href="#M000049">randomize</a>&nbsp;&nbsp;
106
- <a href="#M000043">remove</a>&nbsp;&nbsp;
107
- <a href="#M000044">remove!</a>&nbsp;&nbsp;
108
- <a href="#M000036">singular</a>&nbsp;&nbsp;
109
- <a href="#M000054">sql_safe_str</a>&nbsp;&nbsp;
110
- <a href="#M000055">sql_safe_str!</a>&nbsp;&nbsp;
111
- <a href="#M000040">starts_with?</a>&nbsp;&nbsp;
112
- <a href="#M000050">truncate</a>&nbsp;&nbsp;
113
- <a href="#M000051">truncate!</a>&nbsp;&nbsp;
114
- <a href="#M000039">underscore</a>&nbsp;&nbsp;
91
+ <a href="#M000033">blank?</a>&nbsp;&nbsp;
92
+ <a href="#M000044">breakify</a>&nbsp;&nbsp;
93
+ <a href="#M000045">breakify!</a>&nbsp;&nbsp;
94
+ <a href="#M000031">camelcase</a>&nbsp;&nbsp;
95
+ <a href="#M000051">capitalize_all_words</a>&nbsp;&nbsp;
96
+ <a href="#M000052">capitalize_all_words!</a>&nbsp;&nbsp;
97
+ <a href="#M000032">constantize</a>&nbsp;&nbsp;
98
+ <a href="#M000040">ends_with?</a>&nbsp;&nbsp;
99
+ <a href="#M000046">hexdigest</a>&nbsp;&nbsp;
100
+ <a href="#M000047">hexdigest!</a>&nbsp;&nbsp;
101
+ <a href="#M000036">linkify</a>&nbsp;&nbsp;
102
+ <a href="#M000037">methodize</a>&nbsp;&nbsp;
103
+ <a href="#M000034">plural</a>&nbsp;&nbsp;
104
+ <a href="#M000041">pluralize_word</a>&nbsp;&nbsp;
105
+ <a href="#M000048">randomize</a>&nbsp;&nbsp;
106
+ <a href="#M000042">remove</a>&nbsp;&nbsp;
107
+ <a href="#M000043">remove!</a>&nbsp;&nbsp;
108
+ <a href="#M000035">singular</a>&nbsp;&nbsp;
109
+ <a href="#M000053">sql_safe_str</a>&nbsp;&nbsp;
110
+ <a href="#M000054">sql_safe_str!</a>&nbsp;&nbsp;
111
+ <a href="#M000039">starts_with?</a>&nbsp;&nbsp;
112
+ <a href="#M000030">to_instance</a>&nbsp;&nbsp;
113
+ <a href="#M000049">truncate</a>&nbsp;&nbsp;
114
+ <a href="#M000050">truncate!</a>&nbsp;&nbsp;
115
+ <a href="#M000038">underscore</a>&nbsp;&nbsp;
115
116
  </div>
116
117
  </div>
117
118
 
@@ -133,11 +134,11 @@
133
134
  <div id="methods">
134
135
  <h3 class="section-bar">Public Class methods</h3>
135
136
 
136
- <div id="method-M000042" class="method-detail">
137
- <a name="M000042"></a>
137
+ <div id="method-M000041" class="method-detail">
138
+ <a name="M000041"></a>
138
139
 
139
140
  <div class="method-heading">
140
- <a href="#M000042" class="method-signature">
141
+ <a href="#M000041" class="method-signature">
141
142
  <span class="method-name">pluralize_word</span><span class="method-args">(num, vals = [&quot;is&quot;, &quot;are&quot;])</span>
142
143
  </a>
143
144
  </div>
@@ -148,40 +149,40 @@ Returns &quot;is&quot; or &quot;are&quot; based on the number, i.e.
148
149
  &quot;i=6; There #{isare(i)} #{i} topics here.&quot;
149
150
  </p>
150
151
  <p><a class="source-toggle" href="#"
151
- onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
152
- <div class="method-source-code" id="M000042-source">
152
+ onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
153
+ <div class="method-source-code" id="M000041-source">
153
154
  <pre>
154
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 165</span>
155
- 165: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pluralize_word</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">vals</span> = [<span class="ruby-value str">&quot;is&quot;</span>, <span class="ruby-value str">&quot;are&quot;</span>])
156
- 166: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">vals</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">num</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">==</span><span class="ruby-value">1</span>
157
- 167: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">vals</span>[<span class="ruby-value">1</span>]
158
- 168: <span class="ruby-keyword kw">end</span>
155
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 170</span>
156
+ 170: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pluralize_word</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">vals</span> = [<span class="ruby-value str">&quot;is&quot;</span>, <span class="ruby-value str">&quot;are&quot;</span>])
157
+ 171: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">vals</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">num</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">==</span><span class="ruby-value">1</span>
158
+ 172: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">vals</span>[<span class="ruby-value">1</span>]
159
+ 173: <span class="ruby-keyword kw">end</span>
159
160
  </pre>
160
161
  </div>
161
162
  </div>
162
163
  </div>
163
164
 
164
- <div id="method-M000049" class="method-detail">
165
- <a name="M000049"></a>
165
+ <div id="method-M000048" class="method-detail">
166
+ <a name="M000048"></a>
166
167
 
167
168
  <div class="method-heading">
168
- <a href="#M000049" class="method-signature">
169
+ <a href="#M000048" class="method-signature">
169
170
  <span class="method-name">randomize</span><span class="method-args">(length = 10)</span>
170
171
  </a>
171
172
  </div>
172
173
 
173
174
  <div class="method-description">
174
175
  <p><a class="source-toggle" href="#"
175
- onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
176
- <div class="method-source-code" id="M000049-source">
176
+ onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
177
+ <div class="method-source-code" id="M000048-source">
177
178
  <pre>
178
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 219</span>
179
- 219: <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>)
180
- 220: <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>
181
- 221: <span class="ruby-identifier">newpass</span> = <span class="ruby-value str">&quot;&quot;</span>
182
- 222: <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>)] }
183
- 223: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">newpass</span>.<span class="ruby-identifier">upcase</span>
184
- 224: <span class="ruby-keyword kw">end</span>
179
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 224</span>
180
+ 224: <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>)
181
+ 225: <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>
182
+ 226: <span class="ruby-identifier">newpass</span> = <span class="ruby-value str">&quot;&quot;</span>
183
+ 227: <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>)] }
184
+ 228: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">newpass</span>.<span class="ruby-identifier">upcase</span>
185
+ 229: <span class="ruby-keyword kw">end</span>
185
186
  </pre>
186
187
  </div>
187
188
  </div>
@@ -189,11 +190,11 @@ Returns &quot;is&quot; or &quot;are&quot; based on the number, i.e.
189
190
 
190
191
  <h3 class="section-bar">Public Instance methods</h3>
191
192
 
192
- <div id="method-M000034" class="method-detail">
193
- <a name="M000034"></a>
193
+ <div id="method-M000033" class="method-detail">
194
+ <a name="M000033"></a>
194
195
 
195
196
  <div class="method-heading">
196
- <a href="#M000034" class="method-signature">
197
+ <a href="#M000033" class="method-signature">
197
198
  <span class="method-name">blank?</span><span class="method-args">()</span>
198
199
  </a>
199
200
  </div>
@@ -203,23 +204,23 @@ Returns &quot;is&quot; or &quot;are&quot; based on the number, i.e.
203
204
  If the string is empty, this will return true.
204
205
  </p>
205
206
  <p><a class="source-toggle" href="#"
206
- onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
207
- <div class="method-source-code" id="M000034-source">
207
+ onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
208
+ <div class="method-source-code" id="M000033-source">
208
209
  <pre>
209
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 25</span>
210
- 25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blank?</span>
211
- 26: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
212
- 27: <span class="ruby-keyword kw">end</span>
210
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 30</span>
211
+ 30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blank?</span>
212
+ 31: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
213
+ 32: <span class="ruby-keyword kw">end</span>
213
214
  </pre>
214
215
  </div>
215
216
  </div>
216
217
  </div>
217
218
 
218
- <div id="method-M000045" class="method-detail">
219
- <a name="M000045"></a>
219
+ <div id="method-M000044" class="method-detail">
220
+ <a name="M000044"></a>
220
221
 
221
222
  <div class="method-heading">
222
- <a href="#M000045" class="method-signature">
223
+ <a href="#M000044" class="method-signature">
223
224
  <span class="method-name">breakify</span><span class="method-args">(every = 30)</span>
224
225
  </a>
225
226
  </div>
@@ -237,66 +238,66 @@ note: if the txt has spaces, this will only try to break up runs of
237
238
  non-space characters longer than &quot;every&quot; characters
238
239
  </p>
239
240
  <p><a class="source-toggle" href="#"
240
- onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
241
- <div class="method-source-code" id="M000045-source">
241
+ onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
242
+ <div class="method-source-code" id="M000044-source">
242
243
  <pre>
243
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 183</span>
244
- 183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">breakify</span>(<span class="ruby-identifier">every</span> = <span class="ruby-value">30</span>)
245
- 184: <span class="ruby-identifier">every</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">every</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span>
246
- 185: <span class="ruby-identifier">text</span> = <span class="ruby-keyword kw">self</span>
247
- 186: <span class="ruby-identifier">textile_regex</span> = <span class="ruby-regexp re">/\&quot;([^\&quot;]+)\&quot;:([^:]*:[\/\/]{0,1}[^ ]*)/</span>
248
- 187: <span class="ruby-identifier">long_regex</span> = <span class="ruby-node">/\S{#{every},}/</span>
249
- 188: <span class="ruby-identifier">brokentxt</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">long_regex</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">longword</span><span class="ruby-operator">|</span>
250
- 189: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">longword</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">textile_regex</span> <span class="ruby-comment cmt">#if the longword is a textile link...ignore and recheck for the link text only</span>
251
- 190: <span class="ruby-identifier">textile_link</span> = <span class="ruby-identifier">textile_regex</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">longword</span>)[<span class="ruby-value">0</span>]
252
- 191: <span class="ruby-identifier">link_text</span> = <span class="ruby-identifier">textile_regex</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">longword</span>)[<span class="ruby-value">1</span>]
253
- 192: <span class="ruby-identifier">longword</span> = <span class="ruby-identifier">link_text</span>
254
- 193: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">longword</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">long_regex</span> <span class="ruby-comment cmt">#link text is long...allow break</span>
255
- 194: <span class="ruby-identifier">textile_link</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-node">/.{1,#{every}}/</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;&lt;wbr/&gt;&quot;</span>)
256
- 195: <span class="ruby-keyword kw">else</span>
257
- 196: <span class="ruby-identifier">textile_link</span> <span class="ruby-comment cmt">#the url is what triggered the match...so leave it alone</span>
258
- 197: <span class="ruby-keyword kw">end</span>
259
- 198: <span class="ruby-keyword kw">else</span>
260
- 199: <span class="ruby-identifier">longword</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-node">/.{1,#{every}}/</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;&lt;wbr/&gt;&quot;</span>) <span class="ruby-comment cmt">#no textile link matched</span>
261
- 200: <span class="ruby-keyword kw">end</span>
262
- 201: <span class="ruby-keyword kw">end</span>
263
- 202: <span class="ruby-comment cmt">#text = %Q[&lt;span style='word-wrap:break-word;wbr:after{content:&quot;\\00200B&quot;}'&gt;#{brokentxt}&lt;/span&gt;]</span>
264
- 203: <span class="ruby-comment cmt">#brokentxt.gsub(&quot;&lt;wbr/&gt;&quot;, &quot;&lt;br /&gt;&quot;)</span>
265
- 204: <span class="ruby-identifier">brokentxt</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;&lt;wbr/&gt;&quot;</span>, <span class="ruby-value str">&quot; &quot;</span>)
266
- 205: <span class="ruby-keyword kw">end</span>
244
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 188</span>
245
+ 188: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">breakify</span>(<span class="ruby-identifier">every</span> = <span class="ruby-value">30</span>)
246
+ 189: <span class="ruby-identifier">every</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">every</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span>
247
+ 190: <span class="ruby-identifier">text</span> = <span class="ruby-keyword kw">self</span>
248
+ 191: <span class="ruby-identifier">textile_regex</span> = <span class="ruby-regexp re">/\&quot;([^\&quot;]+)\&quot;:([^:]*:[\/\/]{0,1}[^ ]*)/</span>
249
+ 192: <span class="ruby-identifier">long_regex</span> = <span class="ruby-node">/\S{#{every},}/</span>
250
+ 193: <span class="ruby-identifier">brokentxt</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">long_regex</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">longword</span><span class="ruby-operator">|</span>
251
+ 194: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">longword</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">textile_regex</span> <span class="ruby-comment cmt">#if the longword is a textile link...ignore and recheck for the link text only</span>
252
+ 195: <span class="ruby-identifier">textile_link</span> = <span class="ruby-identifier">textile_regex</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">longword</span>)[<span class="ruby-value">0</span>]
253
+ 196: <span class="ruby-identifier">link_text</span> = <span class="ruby-identifier">textile_regex</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">longword</span>)[<span class="ruby-value">1</span>]
254
+ 197: <span class="ruby-identifier">longword</span> = <span class="ruby-identifier">link_text</span>
255
+ 198: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">longword</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">long_regex</span> <span class="ruby-comment cmt">#link text is long...allow break</span>
256
+ 199: <span class="ruby-identifier">textile_link</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-node">/.{1,#{every}}/</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;&lt;wbr/&gt;&quot;</span>)
257
+ 200: <span class="ruby-keyword kw">else</span>
258
+ 201: <span class="ruby-identifier">textile_link</span> <span class="ruby-comment cmt">#the url is what triggered the match...so leave it alone</span>
259
+ 202: <span class="ruby-keyword kw">end</span>
260
+ 203: <span class="ruby-keyword kw">else</span>
261
+ 204: <span class="ruby-identifier">longword</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-node">/.{1,#{every}}/</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;&lt;wbr/&gt;&quot;</span>) <span class="ruby-comment cmt">#no textile link matched</span>
262
+ 205: <span class="ruby-keyword kw">end</span>
263
+ 206: <span class="ruby-keyword kw">end</span>
264
+ 207: <span class="ruby-comment cmt">#text = %Q[&lt;span style='word-wrap:break-word;wbr:after{content:&quot;\\00200B&quot;}'&gt;#{brokentxt}&lt;/span&gt;]</span>
265
+ 208: <span class="ruby-comment cmt">#brokentxt.gsub(&quot;&lt;wbr/&gt;&quot;, &quot;&lt;br /&gt;&quot;)</span>
266
+ 209: <span class="ruby-identifier">brokentxt</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;&lt;wbr/&gt;&quot;</span>, <span class="ruby-value str">&quot; &quot;</span>)
267
+ 210: <span class="ruby-keyword kw">end</span>
267
268
  </pre>
268
269
  </div>
269
270
  </div>
270
271
  </div>
271
272
 
272
- <div id="method-M000046" class="method-detail">
273
- <a name="M000046"></a>
273
+ <div id="method-M000045" class="method-detail">
274
+ <a name="M000045"></a>
274
275
 
275
276
  <div class="method-heading">
276
- <a href="#M000046" class="method-signature">
277
+ <a href="#M000045" class="method-signature">
277
278
  <span class="method-name">breakify!</span><span class="method-args">(every = 30)</span>
278
279
  </a>
279
280
  </div>
280
281
 
281
282
  <div class="method-description">
282
283
  <p><a class="source-toggle" href="#"
283
- onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
284
- <div class="method-source-code" id="M000046-source">
284
+ onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
285
+ <div class="method-source-code" id="M000045-source">
285
286
  <pre>
286
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 207</span>
287
- 207: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">breakify!</span>(<span class="ruby-identifier">every</span> = <span class="ruby-value">30</span>)
288
- 208: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">breakify</span>(<span class="ruby-identifier">every</span>))
289
- 209: <span class="ruby-keyword kw">end</span>
287
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 212</span>
288
+ 212: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">breakify!</span>(<span class="ruby-identifier">every</span> = <span class="ruby-value">30</span>)
289
+ 213: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">breakify</span>(<span class="ruby-identifier">every</span>))
290
+ 214: <span class="ruby-keyword kw">end</span>
290
291
  </pre>
291
292
  </div>
292
293
  </div>
293
294
  </div>
294
295
 
295
- <div id="method-M000032" class="method-detail">
296
- <a name="M000032"></a>
296
+ <div id="method-M000031" class="method-detail">
297
+ <a name="M000031"></a>
297
298
 
298
299
  <div class="method-heading">
299
- <a href="#M000032" class="method-signature">
300
+ <a href="#M000031" class="method-signature">
300
301
  <span class="method-name">camelcase</span><span class="method-args">()</span>
301
302
  </a>
302
303
  </div>
@@ -314,69 +315,69 @@ Examples:
314
315
  &quot;my/blog&quot;.camelcase # =&gt; My::Blog
315
316
  </pre>
316
317
  <p><a class="source-toggle" href="#"
317
- onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
318
- <div class="method-source-code" id="M000032-source">
318
+ onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
319
+ <div class="method-source-code" id="M000031-source">
319
320
  <pre>
320
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 10</span>
321
- 10: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camelcase</span>
322
- 11: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\/(.?)/</span>) { <span class="ruby-value str">&quot;::&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">upcase</span> }.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(^|_)(.)/</span>) { <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
323
- 12: <span class="ruby-keyword kw">end</span>
321
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 15</span>
322
+ 15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camelcase</span>
323
+ 16: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\/(.?)/</span>) { <span class="ruby-value str">&quot;::&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">upcase</span> }.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(^|_)(.)/</span>) { <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
324
+ 17: <span class="ruby-keyword kw">end</span>
324
325
  </pre>
325
326
  </div>
326
327
  </div>
327
328
  </div>
328
329
 
329
- <div id="method-M000052" class="method-detail">
330
- <a name="M000052"></a>
330
+ <div id="method-M000051" class="method-detail">
331
+ <a name="M000051"></a>
331
332
 
332
333
  <div class="method-heading">
333
- <a href="#M000052" class="method-signature">
334
+ <a href="#M000051" class="method-signature">
334
335
  <span class="method-name">capitalize_all_words</span><span class="method-args">()</span>
335
336
  </a>
336
337
  </div>
337
338
 
338
339
  <div class="method-description">
339
340
  <p><a class="source-toggle" href="#"
340
- onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
341
- <div class="method-source-code" id="M000052-source">
341
+ onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
342
+ <div class="method-source-code" id="M000051-source">
342
343
  <pre>
343
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 241</span>
344
- 241: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capitalize_all_words</span>
345
- 242: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\b\w/</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">upcase</span>}
346
- 243: <span class="ruby-keyword kw">end</span>
344
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 246</span>
345
+ 246: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capitalize_all_words</span>
346
+ 247: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\b\w/</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">upcase</span>}
347
+ 248: <span class="ruby-keyword kw">end</span>
347
348
  </pre>
348
349
  </div>
349
350
  </div>
350
351
  </div>
351
352
 
352
- <div id="method-M000053" class="method-detail">
353
- <a name="M000053"></a>
353
+ <div id="method-M000052" class="method-detail">
354
+ <a name="M000052"></a>
354
355
 
355
356
  <div class="method-heading">
356
- <a href="#M000053" class="method-signature">
357
+ <a href="#M000052" class="method-signature">
357
358
  <span class="method-name">capitalize_all_words!</span><span class="method-args">()</span>
358
359
  </a>
359
360
  </div>
360
361
 
361
362
  <div class="method-description">
362
363
  <p><a class="source-toggle" href="#"
363
- onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
364
- <div class="method-source-code" id="M000053-source">
364
+ onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
365
+ <div class="method-source-code" id="M000052-source">
365
366
  <pre>
366
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 245</span>
367
- 245: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capitalize_all_words!</span>
368
- 246: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">capitalize_all_words</span>)
369
- 247: <span class="ruby-keyword kw">end</span>
367
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 250</span>
368
+ 250: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capitalize_all_words!</span>
369
+ 251: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">capitalize_all_words</span>)
370
+ 252: <span class="ruby-keyword kw">end</span>
370
371
  </pre>
371
372
  </div>
372
373
  </div>
373
374
  </div>
374
375
 
375
- <div id="method-M000033" class="method-detail">
376
- <a name="M000033"></a>
376
+ <div id="method-M000032" class="method-detail">
377
+ <a name="M000032"></a>
377
378
 
378
379
  <div class="method-heading">
379
- <a href="#M000033" class="method-signature">
380
+ <a href="#M000032" class="method-signature">
380
381
  <span class="method-name">constantize</span><span class="method-args">()</span>
381
382
  </a>
382
383
  </div>
@@ -394,238 +395,238 @@ Examples:
394
395
  &quot;Mack::Configuration&quot; # =&gt; Mack::Configuration
395
396
  </pre>
396
397
  <p><a class="source-toggle" href="#"
397
- onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
398
- <div class="method-source-code" id="M000033-source">
398
+ onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
399
+ <div class="method-source-code" id="M000032-source">
399
400
  <pre>
400
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 20</span>
401
- 20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">constantize</span>
402
- 21: <span class="ruby-constant">Module</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-node">&quot;::#{self}&quot;</span>)
403
- 22: <span class="ruby-keyword kw">end</span>
401
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 25</span>
402
+ 25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">constantize</span>
403
+ 26: <span class="ruby-constant">Module</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-node">&quot;::#{self}&quot;</span>)
404
+ 27: <span class="ruby-keyword kw">end</span>
404
405
  </pre>
405
406
  </div>
406
407
  </div>
407
408
  </div>
408
409
 
409
- <div id="method-M000041" class="method-detail">
410
- <a name="M000041"></a>
410
+ <div id="method-M000040" class="method-detail">
411
+ <a name="M000040"></a>
411
412
 
412
413
  <div class="method-heading">
413
- <a href="#M000041" class="method-signature">
414
+ <a href="#M000040" class="method-signature">
414
415
  <span class="method-name">ends_with?</span><span class="method-args">(x)</span>
415
416
  </a>
416
417
  </div>
417
418
 
418
419
  <div class="method-description">
419
420
  <p><a class="source-toggle" href="#"
420
- onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
421
- <div class="method-source-code" id="M000041-source">
421
+ onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
422
+ <div class="method-source-code" id="M000040-source">
422
423
  <pre>
423
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 160</span>
424
- 160: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ends_with?</span>(<span class="ruby-identifier">x</span>)
425
- 161: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/#{x}$/</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
426
- 162: <span class="ruby-keyword kw">end</span>
424
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 165</span>
425
+ 165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ends_with?</span>(<span class="ruby-identifier">x</span>)
426
+ 166: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/#{x}$/</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
427
+ 167: <span class="ruby-keyword kw">end</span>
427
428
  </pre>
428
429
  </div>
429
430
  </div>
430
431
  </div>
431
432
 
432
- <div id="method-M000047" class="method-detail">
433
- <a name="M000047"></a>
433
+ <div id="method-M000046" class="method-detail">
434
+ <a name="M000046"></a>
434
435
 
435
436
  <div class="method-heading">
436
- <a href="#M000047" class="method-signature">
437
+ <a href="#M000046" class="method-signature">
437
438
  <span class="method-name">hexdigest</span><span class="method-args">()</span>
438
439
  </a>
439
440
  </div>
440
441
 
441
442
  <div class="method-description">
442
443
  <p><a class="source-toggle" href="#"
443
- onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
444
- <div class="method-source-code" id="M000047-source">
444
+ onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
445
+ <div class="method-source-code" id="M000046-source">
445
446
  <pre>
446
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 211</span>
447
- 211: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hexdigest</span>
448
- 212: <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>.<span class="ruby-identifier">downcase</span>)
449
- 213: <span class="ruby-keyword kw">end</span>
447
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 216</span>
448
+ 216: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hexdigest</span>
449
+ 217: <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>.<span class="ruby-identifier">downcase</span>)
450
+ 218: <span class="ruby-keyword kw">end</span>
450
451
  </pre>
451
452
  </div>
452
453
  </div>
453
454
  </div>
454
455
 
455
- <div id="method-M000048" class="method-detail">
456
- <a name="M000048"></a>
456
+ <div id="method-M000047" class="method-detail">
457
+ <a name="M000047"></a>
457
458
 
458
459
  <div class="method-heading">
459
- <a href="#M000048" class="method-signature">
460
+ <a href="#M000047" class="method-signature">
460
461
  <span class="method-name">hexdigest!</span><span class="method-args">()</span>
461
462
  </a>
462
463
  </div>
463
464
 
464
465
  <div class="method-description">
465
466
  <p><a class="source-toggle" href="#"
466
- onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
467
- <div class="method-source-code" id="M000048-source">
467
+ onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
468
+ <div class="method-source-code" id="M000047-source">
468
469
  <pre>
469
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 215</span>
470
- 215: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hexdigest!</span>
471
- 216: <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>)
472
- 217: <span class="ruby-keyword kw">end</span>
470
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 220</span>
471
+ 220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hexdigest!</span>
472
+ 221: <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>)
473
+ 222: <span class="ruby-keyword kw">end</span>
473
474
  </pre>
474
475
  </div>
475
476
  </div>
476
477
  </div>
477
478
 
478
- <div id="method-M000037" class="method-detail">
479
- <a name="M000037"></a>
479
+ <div id="method-M000036" class="method-detail">
480
+ <a name="M000036"></a>
480
481
 
481
482
  <div class="method-heading">
482
- <a href="#M000037" class="method-signature">
483
+ <a href="#M000036" class="method-signature">
483
484
  <span class="method-name">linkify</span><span class="method-args">(enabled = true, options = {}) {|t, url, options| ...}</span>
484
485
  </a>
485
486
  </div>
486
487
 
487
488
  <div class="method-description">
488
489
  <p><a class="source-toggle" href="#"
489
- onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
490
- <div class="method-source-code" id="M000037-source">
490
+ onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
491
+ <div class="method-source-code" id="M000036-source">
491
492
  <pre>
492
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 39</span>
493
- 39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">linkify</span>(<span class="ruby-identifier">enabled</span> = <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
494
- 40: <span class="ruby-identifier">text</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
495
- 41: <span class="ruby-identifier">m</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\&quot;([^&quot;]+)\&quot;\:([^:]+\:\S+)/</span>)
496
- 42: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">nil?</span>
497
- 43: <span class="ruby-identifier">y</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_s</span>
498
- 44: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">m</span>[<span class="ruby-value">1</span>]
499
- 45: <span class="ruby-identifier">url</span> = <span class="ruby-identifier">m</span>[<span class="ruby-value">2</span>]
500
- 46:
501
- 47: <span class="ruby-comment cmt"># The code below handles punctuation or p tags being mistakenly added to the url when the link is at the end of a sentence or body</span>
502
- 48: <span class="ruby-identifier">url_punct_match</span> = <span class="ruby-regexp re">/\W*[&amp;nbsp;]*[\&lt;\/p\&gt;]*$/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">url</span>)
503
- 49: <span class="ruby-identifier">punct</span> = <span class="ruby-value str">''</span>
504
- 50: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">url_punct_match</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">url_punct_match</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;&quot;</span>
505
- 51: <span class="ruby-identifier">url</span>.<span class="ruby-identifier">chomp!</span>(<span class="ruby-identifier">url_punct_match</span>[<span class="ruby-value">0</span>])
506
- 52: <span class="ruby-identifier">punct</span> = <span class="ruby-identifier">url_punct_match</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">url_punct_match</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;=&quot;</span>
507
- 53: <span class="ruby-keyword kw">end</span>
508
- 54:
509
- 55: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
510
- 56: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">enabled</span>
511
- 57: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">t</span>, <span class="ruby-identifier">url</span>, <span class="ruby-identifier">options</span>
512
- 58: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">y</span>, <span class="ruby-identifier">ret</span>)
513
- 59: <span class="ruby-keyword kw">else</span>
514
- 60: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">y</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>)
515
- 61: <span class="ruby-keyword kw">end</span>
516
- 62: <span class="ruby-keyword kw">else</span>
517
- 63: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">enabled</span>
518
- 64: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">y</span>, <span class="ruby-node">&quot;&lt;a href=\&quot;#{url}\&quot; #{options.join(&quot;%s=\&quot;%s\&quot;&quot;, &quot; &quot;)}&gt;#{t}&lt;/a&gt;#{punct}&quot;</span>)<span class="ruby-comment cmt"># punct places punctuation back into proper place</span>
519
- 65: <span class="ruby-keyword kw">else</span>
520
- 66: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">y</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>)
521
- 67: <span class="ruby-keyword kw">end</span>
522
- 68: <span class="ruby-keyword kw">end</span>
523
- 69: <span class="ruby-identifier">m</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\&quot;([^&quot;]+)\&quot;\:([^:]+\:\S+)/</span>)
524
- 70: <span class="ruby-keyword kw">end</span>
525
- 71: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>
526
- 72: <span class="ruby-keyword kw">end</span>
493
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 44</span>
494
+ 44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">linkify</span>(<span class="ruby-identifier">enabled</span> = <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
495
+ 45: <span class="ruby-identifier">text</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
496
+ 46: <span class="ruby-identifier">m</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\&quot;([^&quot;]+)\&quot;\:([^:]+\:\S+)/</span>)
497
+ 47: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">nil?</span>
498
+ 48: <span class="ruby-identifier">y</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_s</span>
499
+ 49: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">m</span>[<span class="ruby-value">1</span>]
500
+ 50: <span class="ruby-identifier">url</span> = <span class="ruby-identifier">m</span>[<span class="ruby-value">2</span>]
501
+ 51:
502
+ 52: <span class="ruby-comment cmt"># The code below handles punctuation or p tags being mistakenly added to the url when the link is at the end of a sentence or body</span>
503
+ 53: <span class="ruby-identifier">url_punct_match</span> = <span class="ruby-regexp re">/\W*[&amp;nbsp;]*[\&lt;\/p\&gt;]*$/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">url</span>)
504
+ 54: <span class="ruby-identifier">punct</span> = <span class="ruby-value str">''</span>
505
+ 55: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">url_punct_match</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">url_punct_match</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;&quot;</span>
506
+ 56: <span class="ruby-identifier">url</span>.<span class="ruby-identifier">chomp!</span>(<span class="ruby-identifier">url_punct_match</span>[<span class="ruby-value">0</span>])
507
+ 57: <span class="ruby-identifier">punct</span> = <span class="ruby-identifier">url_punct_match</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">url_punct_match</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;=&quot;</span>
508
+ 58: <span class="ruby-keyword kw">end</span>
509
+ 59:
510
+ 60: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
511
+ 61: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">enabled</span>
512
+ 62: <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">t</span>, <span class="ruby-identifier">url</span>, <span class="ruby-identifier">options</span>
513
+ 63: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">y</span>, <span class="ruby-identifier">ret</span>)
514
+ 64: <span class="ruby-keyword kw">else</span>
515
+ 65: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">y</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>)
516
+ 66: <span class="ruby-keyword kw">end</span>
517
+ 67: <span class="ruby-keyword kw">else</span>
518
+ 68: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">enabled</span>
519
+ 69: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">y</span>, <span class="ruby-node">&quot;&lt;a href=\&quot;#{url}\&quot; #{options.join(&quot;%s=\&quot;%s\&quot;&quot;, &quot; &quot;)}&gt;#{t}&lt;/a&gt;#{punct}&quot;</span>)<span class="ruby-comment cmt"># punct places punctuation back into proper place</span>
520
+ 70: <span class="ruby-keyword kw">else</span>
521
+ 71: <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">y</span>, <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span>)
522
+ 72: <span class="ruby-keyword kw">end</span>
523
+ 73: <span class="ruby-keyword kw">end</span>
524
+ 74: <span class="ruby-identifier">m</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\&quot;([^&quot;]+)\&quot;\:([^:]+\:\S+)/</span>)
525
+ 75: <span class="ruby-keyword kw">end</span>
526
+ 76: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>
527
+ 77: <span class="ruby-keyword kw">end</span>
527
528
  </pre>
528
529
  </div>
529
530
  </div>
530
531
  </div>
531
532
 
532
- <div id="method-M000038" class="method-detail">
533
- <a name="M000038"></a>
533
+ <div id="method-M000037" class="method-detail">
534
+ <a name="M000037"></a>
534
535
 
535
536
  <div class="method-heading">
536
- <a href="#M000038" class="method-signature">
537
+ <a href="#M000037" class="method-signature">
537
538
  <span class="method-name">methodize</span><span class="method-args">()</span>
538
539
  </a>
539
540
  </div>
540
541
 
541
542
  <div class="method-description">
542
543
  <p><a class="source-toggle" href="#"
543
- onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
544
- <div class="method-source-code" id="M000038-source">
544
+ onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
545
+ <div class="method-source-code" id="M000037-source">
545
546
  <pre>
546
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 74</span>
547
- 74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">methodize</span>
548
- 75: <span class="ruby-identifier">x</span> = <span class="ruby-keyword kw">self</span>
549
- 76:
550
- 77: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
551
- 78: <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>
552
- 79:
553
- 80: <span class="ruby-comment cmt"># get rid of the big stuff in the front/back</span>
554
- 81: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">strip!</span>
555
- 82:
556
- 83: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
557
- 84: <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>
558
- 85:
559
- 86: <span class="ruby-identifier">x</span> = <span class="ruby-identifier">x</span>.<span class="ruby-identifier">underscore</span>
547
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 79</span>
548
+ 79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">methodize</span>
549
+ 80: <span class="ruby-identifier">x</span> = <span class="ruby-keyword kw">self</span>
550
+ 81:
551
+ 82: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
552
+ 83: <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>
553
+ 84:
554
+ 85: <span class="ruby-comment cmt"># get rid of the big stuff in the front/back</span>
555
+ 86: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">strip!</span>
560
556
  87:
561
- 88: <span class="ruby-comment cmt"># get rid of spaces and make the _</span>
562
- 89: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'_'</span>)
563
- 90: <span class="ruby-comment cmt"># get rid of everything that isn't 'safe' a-z, 0-9, ?, !, =, _</span>
564
- 91: <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>)
557
+ 88: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
558
+ 89: <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>
559
+ 90:
560
+ 91: <span class="ruby-identifier">x</span> = <span class="ruby-identifier">x</span>.<span class="ruby-identifier">underscore</span>
565
561
  92:
566
- 93: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
567
- 94: <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>
568
- 95:
569
- 96: <span class="ruby-comment cmt"># condense multiple 'safe' non a-z chars to just one.</span>
570
- 97: <span class="ruby-comment cmt"># ie. ___ becomes _ !!!! becomes ! etc...</span>
571
- 98: [<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>
572
- 99: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">squeeze!</span>(<span class="ruby-identifier">c</span>)
573
- 100: <span class="ruby-keyword kw">end</span>
574
- 101:
575
- 102: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
576
- 103: <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>
577
- 104:
578
- 105: <span class="ruby-comment cmt">#down case the whole thing</span>
579
- 106: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">downcase!</span>
580
- 107:
581
- 108: <span class="ruby-comment cmt"># get rid of any characters at the beginning that aren't a-z</span>
582
- 109: <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>)
583
- 110: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
584
- 111:
585
- 112: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
586
- 113: <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>
587
- 114: <span class="ruby-keyword kw">end</span>
588
- 115:
589
- 116: <span class="ruby-comment cmt"># let's trim this bad boy down a bit now that we've cleaned it up, somewhat.</span>
590
- 117: <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>
591
- 118: <span class="ruby-comment cmt"># bad char at the end if you trim too late.</span>
592
- 119: <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>
562
+ 93: <span class="ruby-comment cmt"># get rid of spaces and make the _</span>
563
+ 94: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'_'</span>)
564
+ 95: <span class="ruby-comment cmt"># get rid of everything that isn't 'safe' a-z, 0-9, ?, !, =, _</span>
565
+ 96: <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>)
566
+ 97:
567
+ 98: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
568
+ 99: <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>
569
+ 100:
570
+ 101: <span class="ruby-comment cmt"># condense multiple 'safe' non a-z chars to just one.</span>
571
+ 102: <span class="ruby-comment cmt"># ie. ___ becomes _ !!!! becomes ! etc...</span>
572
+ 103: [<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>
573
+ 104: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">squeeze!</span>(<span class="ruby-identifier">c</span>)
574
+ 105: <span class="ruby-keyword kw">end</span>
575
+ 106:
576
+ 107: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
577
+ 108: <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>
578
+ 109:
579
+ 110: <span class="ruby-comment cmt">#down case the whole thing</span>
580
+ 111: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">downcase!</span>
581
+ 112:
582
+ 113: <span class="ruby-comment cmt"># get rid of any characters at the beginning that aren't a-z</span>
583
+ 114: <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>)
584
+ 115: <span class="ruby-identifier">x</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
585
+ 116:
586
+ 117: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
587
+ 118: <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>
588
+ 119: <span class="ruby-keyword kw">end</span>
593
589
  120:
594
- 121: <span class="ruby-comment cmt"># get rid of any characters at the end that aren't safe</span>
595
- 122: <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>)
596
- 123: <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>)
597
- 124: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
598
- 125: <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>
599
- 126: <span class="ruby-keyword kw">end</span>
600
- 127:
601
- 128: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
602
- 129: <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>
603
- 130:
604
- 131: <span class="ruby-comment cmt"># let's get rid of characters that don't belong in the 'middle' of the method.</span>
605
- 132: <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>)]
606
- 133: <span class="ruby-identifier">n_middle</span> = <span class="ruby-identifier">orig_middle</span>.<span class="ruby-identifier">dup</span>
607
- 134:
608
- 135: [<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>
609
- 136: <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>)
610
- 137: <span class="ruby-keyword kw">end</span>
611
- 138:
612
- 139: <span class="ruby-comment cmt"># the previous gsub can leave us with multiple underscores that need cleaning up.</span>
613
- 140: <span class="ruby-identifier">n_middle</span>.<span class="ruby-identifier">squeeze!</span>(<span class="ruby-value str">&quot;_&quot;</span>)
614
- 141:
615
- 142: <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>)
616
- 143: <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>)
617
- 144: <span class="ruby-identifier">x</span>
618
- 145: <span class="ruby-keyword kw">end</span>
590
+ 121: <span class="ruby-comment cmt"># let's trim this bad boy down a bit now that we've cleaned it up, somewhat.</span>
591
+ 122: <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>
592
+ 123: <span class="ruby-comment cmt"># bad char at the end if you trim too late.</span>
593
+ 124: <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>
594
+ 125:
595
+ 126: <span class="ruby-comment cmt"># get rid of any characters at the end that aren't safe</span>
596
+ 127: <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>)
597
+ 128: <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>)
598
+ 129: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
599
+ 130: <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>
600
+ 131: <span class="ruby-keyword kw">end</span>
601
+ 132:
602
+ 133: <span class="ruby-comment cmt"># if we get down to a nil or an empty string raise an exception! </span>
603
+ 134: <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>
604
+ 135:
605
+ 136: <span class="ruby-comment cmt"># let's get rid of characters that don't belong in the 'middle' of the method.</span>
606
+ 137: <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>)]
607
+ 138: <span class="ruby-identifier">n_middle</span> = <span class="ruby-identifier">orig_middle</span>.<span class="ruby-identifier">dup</span>
608
+ 139:
609
+ 140: [<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>
610
+ 141: <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>)
611
+ 142: <span class="ruby-keyword kw">end</span>
612
+ 143:
613
+ 144: <span class="ruby-comment cmt"># the previous gsub can leave us with multiple underscores that need cleaning up.</span>
614
+ 145: <span class="ruby-identifier">n_middle</span>.<span class="ruby-identifier">squeeze!</span>(<span class="ruby-value str">&quot;_&quot;</span>)
615
+ 146:
616
+ 147: <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>)
617
+ 148: <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>)
618
+ 149: <span class="ruby-identifier">x</span>
619
+ 150: <span class="ruby-keyword kw">end</span>
619
620
  </pre>
620
621
  </div>
621
622
  </div>
622
623
  </div>
623
624
 
624
- <div id="method-M000035" class="method-detail">
625
- <a name="M000035"></a>
625
+ <div id="method-M000034" class="method-detail">
626
+ <a name="M000034"></a>
626
627
 
627
628
  <div class="method-heading">
628
- <a href="#M000035" class="method-signature">
629
+ <a href="#M000034" class="method-signature">
629
630
  <span class="method-name">plural</span><span class="method-args">()</span>
630
631
  </a>
631
632
  </div>
@@ -635,69 +636,69 @@ Examples:
635
636
  Maps to Mack::Utils::Inflector.instance.pluralize
636
637
  </p>
637
638
  <p><a class="source-toggle" href="#"
638
- onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
639
- <div class="method-source-code" id="M000035-source">
639
+ onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
640
+ <div class="method-source-code" id="M000034-source">
640
641
  <pre>
641
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 30</span>
642
- 30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">plural</span>
643
- 31: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">pluralize</span>(<span class="ruby-keyword kw">self</span>)
644
- 32: <span class="ruby-keyword kw">end</span>
642
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 35</span>
643
+ 35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">plural</span>
644
+ 36: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">pluralize</span>(<span class="ruby-keyword kw">self</span>)
645
+ 37: <span class="ruby-keyword kw">end</span>
645
646
  </pre>
646
647
  </div>
647
648
  </div>
648
649
  </div>
649
650
 
650
- <div id="method-M000043" class="method-detail">
651
- <a name="M000043"></a>
651
+ <div id="method-M000042" class="method-detail">
652
+ <a name="M000042"></a>
652
653
 
653
654
  <div class="method-heading">
654
- <a href="#M000043" class="method-signature">
655
+ <a href="#M000042" class="method-signature">
655
656
  <span class="method-name">remove</span><span class="method-args">(val)</span>
656
657
  </a>
657
658
  </div>
658
659
 
659
660
  <div class="method-description">
660
661
  <p><a class="source-toggle" href="#"
661
- onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
662
- <div class="method-source-code" id="M000043-source">
662
+ onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
663
+ <div class="method-source-code" id="M000042-source">
663
664
  <pre>
664
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 170</span>
665
- 170: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">val</span>)
666
- 171: <span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">val</span>, <span class="ruby-value str">''</span>)
667
- 172: <span class="ruby-keyword kw">end</span>
665
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 175</span>
666
+ 175: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">val</span>)
667
+ 176: <span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">val</span>, <span class="ruby-value str">''</span>)
668
+ 177: <span class="ruby-keyword kw">end</span>
668
669
  </pre>
669
670
  </div>
670
671
  </div>
671
672
  </div>
672
673
 
673
- <div id="method-M000044" class="method-detail">
674
- <a name="M000044"></a>
674
+ <div id="method-M000043" class="method-detail">
675
+ <a name="M000043"></a>
675
676
 
676
677
  <div class="method-heading">
677
- <a href="#M000044" class="method-signature">
678
+ <a href="#M000043" class="method-signature">
678
679
  <span class="method-name">remove!</span><span class="method-args">(val)</span>
679
680
  </a>
680
681
  </div>
681
682
 
682
683
  <div class="method-description">
683
684
  <p><a class="source-toggle" href="#"
684
- onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
685
- <div class="method-source-code" id="M000044-source">
685
+ onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
686
+ <div class="method-source-code" id="M000043-source">
686
687
  <pre>
687
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 174</span>
688
- 174: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove!</span>(<span class="ruby-identifier">val</span>)
689
- 175: <span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">val</span>, <span class="ruby-value str">''</span>)
690
- 176: <span class="ruby-keyword kw">end</span>
688
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 179</span>
689
+ 179: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove!</span>(<span class="ruby-identifier">val</span>)
690
+ 180: <span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">val</span>, <span class="ruby-value str">''</span>)
691
+ 181: <span class="ruby-keyword kw">end</span>
691
692
  </pre>
692
693
  </div>
693
694
  </div>
694
695
  </div>
695
696
 
696
- <div id="method-M000036" class="method-detail">
697
- <a name="M000036"></a>
697
+ <div id="method-M000035" class="method-detail">
698
+ <a name="M000035"></a>
698
699
 
699
700
  <div class="method-heading">
700
- <a href="#M000036" class="method-signature">
701
+ <a href="#M000035" class="method-signature">
701
702
  <span class="method-name">singular</span><span class="method-args">()</span>
702
703
  </a>
703
704
  </div>
@@ -707,23 +708,23 @@ Maps to Mack::Utils::Inflector.instance.pluralize
707
708
  Maps to Mack::Utils::Inflector.instance.singularize
708
709
  </p>
709
710
  <p><a class="source-toggle" href="#"
710
- onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
711
- <div class="method-source-code" id="M000036-source">
711
+ onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
712
+ <div class="method-source-code" id="M000035-source">
712
713
  <pre>
713
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 35</span>
714
- 35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singular</span>
715
- 36: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">singularize</span>(<span class="ruby-keyword kw">self</span>)
716
- 37: <span class="ruby-keyword kw">end</span>
714
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 40</span>
715
+ 40: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singular</span>
716
+ 41: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Utils</span><span class="ruby-operator">::</span><span class="ruby-constant">Inflector</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">singularize</span>(<span class="ruby-keyword kw">self</span>)
717
+ 42: <span class="ruby-keyword kw">end</span>
717
718
  </pre>
718
719
  </div>
719
720
  </div>
720
721
  </div>
721
722
 
722
- <div id="method-M000054" class="method-detail">
723
- <a name="M000054"></a>
723
+ <div id="method-M000053" class="method-detail">
724
+ <a name="M000053"></a>
724
725
 
725
726
  <div class="method-heading">
726
- <a href="#M000054" class="method-signature">
727
+ <a href="#M000053" class="method-signature">
727
728
  <span class="method-name">sql_safe_str</span><span class="method-args">()</span>
728
729
  </a>
729
730
  </div>
@@ -734,142 +735,168 @@ keep adding on to this whenever it becomes apparent that unsafe strings
734
735
  could get passed through into the database
735
736
  </p>
736
737
  <p><a class="source-toggle" href="#"
737
- onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
738
- <div class="method-source-code" id="M000054-source">
738
+ onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
739
+ <div class="method-source-code" id="M000053-source">
739
740
  <pre>
740
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 251</span>
741
- 251: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sql_safe_str</span>
742
- 252: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">nil?</span>
743
- 253: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[\']/</span>, <span class="ruby-value str">&quot;\'\'&quot;</span>)
744
- 254: <span class="ruby-keyword kw">end</span>
745
- 255: <span class="ruby-keyword kw">end</span>
741
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 256</span>
742
+ 256: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sql_safe_str</span>
743
+ 257: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">nil?</span>
744
+ 258: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[\']/</span>, <span class="ruby-value str">&quot;\'\'&quot;</span>)
745
+ 259: <span class="ruby-keyword kw">end</span>
746
+ 260: <span class="ruby-keyword kw">end</span>
746
747
  </pre>
747
748
  </div>
748
749
  </div>
749
750
  </div>
750
751
 
751
- <div id="method-M000055" class="method-detail">
752
- <a name="M000055"></a>
752
+ <div id="method-M000054" class="method-detail">
753
+ <a name="M000054"></a>
753
754
 
754
755
  <div class="method-heading">
755
- <a href="#M000055" class="method-signature">
756
+ <a href="#M000054" class="method-signature">
756
757
  <span class="method-name">sql_safe_str!</span><span class="method-args">()</span>
757
758
  </a>
758
759
  </div>
759
760
 
760
761
  <div class="method-description">
761
762
  <p><a class="source-toggle" href="#"
762
- onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
763
- <div class="method-source-code" id="M000055-source">
763
+ onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
764
+ <div class="method-source-code" id="M000054-source">
764
765
  <pre>
765
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 257</span>
766
- 257: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sql_safe_str!</span>
767
- 258: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sql_safe_str</span>)
768
- 259: <span class="ruby-keyword kw">end</span>
766
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 262</span>
767
+ 262: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sql_safe_str!</span>
768
+ 263: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sql_safe_str</span>)
769
+ 264: <span class="ruby-keyword kw">end</span>
769
770
  </pre>
770
771
  </div>
771
772
  </div>
772
773
  </div>
773
774
 
774
- <div id="method-M000040" class="method-detail">
775
- <a name="M000040"></a>
775
+ <div id="method-M000039" class="method-detail">
776
+ <a name="M000039"></a>
776
777
 
777
778
  <div class="method-heading">
778
- <a href="#M000040" class="method-signature">
779
+ <a href="#M000039" class="method-signature">
779
780
  <span class="method-name">starts_with?</span><span class="method-args">(x)</span>
780
781
  </a>
781
782
  </div>
782
783
 
783
784
  <div class="method-description">
784
785
  <p><a class="source-toggle" href="#"
785
- onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
786
- <div class="method-source-code" id="M000040-source">
786
+ onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
787
+ <div class="method-source-code" id="M000039-source">
787
788
  <pre>
788
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 156</span>
789
- 156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">starts_with?</span>(<span class="ruby-identifier">x</span>)
790
- 157: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/^#{x}/</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
791
- 158: <span class="ruby-keyword kw">end</span>
789
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 161</span>
790
+ 161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">starts_with?</span>(<span class="ruby-identifier">x</span>)
791
+ 162: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">match</span>(<span class="ruby-node">/^#{x}/</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
792
+ 163: <span class="ruby-keyword kw">end</span>
792
793
  </pre>
793
794
  </div>
794
795
  </div>
795
796
  </div>
796
797
 
797
- <div id="method-M000050" class="method-detail">
798
- <a name="M000050"></a>
798
+ <div id="method-M000030" class="method-detail">
799
+ <a name="M000030"></a>
799
800
 
800
801
  <div class="method-heading">
801
- <a href="#M000050" class="method-signature">
802
+ <a href="#M000030" class="method-signature">
803
+ <span class="method-name">to_instance</span><span class="method-args">()</span>
804
+ </a>
805
+ </div>
806
+
807
+ <div class="method-description">
808
+ <p>
809
+ See <a href="Class.html">Class</a> new_instance_of for more details.
810
+ </p>
811
+ <p><a class="source-toggle" href="#"
812
+ onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
813
+ <div class="method-source-code" id="M000030-source">
814
+ <pre>
815
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 5</span>
816
+ 5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_instance</span>
817
+ 6: <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new_instance_of</span>(<span class="ruby-keyword kw">self</span>)
818
+ 7: <span class="ruby-keyword kw">end</span>
819
+ </pre>
820
+ </div>
821
+ </div>
822
+ </div>
823
+
824
+ <div id="method-M000049" class="method-detail">
825
+ <a name="M000049"></a>
826
+
827
+ <div class="method-heading">
828
+ <a href="#M000049" class="method-signature">
802
829
  <span class="method-name">truncate</span><span class="method-args">(length = 30, truncate_string = &quot;...&quot;)</span>
803
830
  </a>
804
831
  </div>
805
832
 
806
833
  <div class="method-description">
807
834
  <p><a class="source-toggle" href="#"
808
- onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
809
- <div class="method-source-code" id="M000050-source">
835
+ onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
836
+ <div class="method-source-code" id="M000049-source">
810
837
  <pre>
811
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 226</span>
812
- 226: <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>)
813
- 227: <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>
814
- 228: <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>
815
- 229: <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>
816
- 230: <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>
817
- 231: <span class="ruby-keyword kw">else</span>
818
- 232: <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>)
819
- 233: <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>
820
- 234: <span class="ruby-keyword kw">end</span>
821
- 235: <span class="ruby-keyword kw">end</span>
838
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 231</span>
839
+ 231: <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>)
840
+ 232: <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>
841
+ 233: <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>
842
+ 234: <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>
843
+ 235: <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>
844
+ 236: <span class="ruby-keyword kw">else</span>
845
+ 237: <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>)
846
+ 238: <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>
847
+ 239: <span class="ruby-keyword kw">end</span>
848
+ 240: <span class="ruby-keyword kw">end</span>
822
849
  </pre>
823
850
  </div>
824
851
  </div>
825
852
  </div>
826
853
 
827
- <div id="method-M000051" class="method-detail">
828
- <a name="M000051"></a>
854
+ <div id="method-M000050" class="method-detail">
855
+ <a name="M000050"></a>
829
856
 
830
857
  <div class="method-heading">
831
- <a href="#M000051" class="method-signature">
858
+ <a href="#M000050" class="method-signature">
832
859
  <span class="method-name">truncate!</span><span class="method-args">(length = 30, truncate_string = &quot;...&quot;)</span>
833
860
  </a>
834
861
  </div>
835
862
 
836
863
  <div class="method-description">
837
864
  <p><a class="source-toggle" href="#"
838
- onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
839
- <div class="method-source-code" id="M000051-source">
865
+ onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
866
+ <div class="method-source-code" id="M000050-source">
840
867
  <pre>
841
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 237</span>
842
- 237: <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>)
843
- 238: <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>))
844
- 239: <span class="ruby-keyword kw">end</span>
868
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 242</span>
869
+ 242: <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>)
870
+ 243: <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>))
871
+ 244: <span class="ruby-keyword kw">end</span>
845
872
  </pre>
846
873
  </div>
847
874
  </div>
848
875
  </div>
849
876
 
850
- <div id="method-M000039" class="method-detail">
851
- <a name="M000039"></a>
877
+ <div id="method-M000038" class="method-detail">
878
+ <a name="M000038"></a>
852
879
 
853
880
  <div class="method-heading">
854
- <a href="#M000039" class="method-signature">
881
+ <a href="#M000038" class="method-signature">
855
882
  <span class="method-name">underscore</span><span class="method-args">()</span>
856
883
  </a>
857
884
  </div>
858
885
 
859
886
  <div class="method-description">
860
887
  <p><a class="source-toggle" href="#"
861
- onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
862
- <div class="method-source-code" id="M000039-source">
888
+ onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
889
+ <div class="method-source-code" id="M000038-source">
863
890
  <pre>
864
- <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 147</span>
865
- 147: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">underscore</span>
866
- 148: <span class="ruby-identifier">camel_cased_word</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
867
- 149: <span class="ruby-identifier">camel_cased_word</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/::/</span>, <span class="ruby-value str">'/'</span>).
868
- 150: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z][a-z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
869
- 151: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z\d])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
870
- 152: <span class="ruby-identifier">tr</span>(<span class="ruby-value str">&quot;-&quot;</span>, <span class="ruby-value str">&quot;_&quot;</span>).
871
- 153: <span class="ruby-identifier">downcase</span>
872
- 154: <span class="ruby-keyword kw">end</span>
891
+ <span class="ruby-comment cmt"># File lib/extensions/string.rb, line 152</span>
892
+ 152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">underscore</span>
893
+ 153: <span class="ruby-identifier">camel_cased_word</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
894
+ 154: <span class="ruby-identifier">camel_cased_word</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/::/</span>, <span class="ruby-value str">'/'</span>).
895
+ 155: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z][a-z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
896
+ 156: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z\d])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
897
+ 157: <span class="ruby-identifier">tr</span>(<span class="ruby-value str">&quot;-&quot;</span>, <span class="ruby-value str">&quot;_&quot;</span>).
898
+ 158: <span class="ruby-identifier">downcase</span>
899
+ 159: <span class="ruby-keyword kw">end</span>
873
900
  </pre>
874
901
  </div>
875
902
  </div>