cowtech-extensions 2.1.3 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.gitignore +1 -0
  2. data/.yardopts +1 -0
  3. data/README.md +10 -0
  4. data/Rakefile +6 -3
  5. data/cowtech-extensions.gemspec +9 -5
  6. data/doc/Cowtech.html +128 -0
  7. data/doc/Cowtech/Extensions.html +546 -0
  8. data/doc/Cowtech/Extensions/Boolean.html +297 -0
  9. data/doc/Cowtech/Extensions/DateTime.html +787 -0
  10. data/doc/Cowtech/Extensions/DateTime/ClassMethods.html +1592 -0
  11. data/doc/Cowtech/Extensions/Exceptions.html +125 -0
  12. data/doc/Cowtech/Extensions/Exceptions/Dump.html +133 -0
  13. data/doc/Cowtech/Extensions/Hash.html +393 -0
  14. data/doc/Cowtech/Extensions/Math.html +130 -0
  15. data/doc/Cowtech/Extensions/Math/ClassMethods.html +362 -0
  16. data/doc/Cowtech/Extensions/Object.html +1565 -0
  17. data/doc/Cowtech/Extensions/Pathname.html +225 -0
  18. data/doc/Cowtech/Extensions/Settings.html +1249 -0
  19. data/doc/Cowtech/Extensions/String.html +471 -0
  20. data/doc/Cowtech/Extensions/TimeZone.html +1210 -0
  21. data/doc/Cowtech/Extensions/TimeZone/ClassMethods.html +925 -0
  22. data/doc/Cowtech/Extensions/Version.html +189 -0
  23. data/doc/_index.html +305 -0
  24. data/doc/class_list.html +53 -0
  25. data/doc/css/common.css +1 -0
  26. data/doc/css/full_list.css +57 -0
  27. data/doc/css/style.css +328 -0
  28. data/doc/file.README.html +103 -0
  29. data/doc/file_list.html +55 -0
  30. data/doc/frames.html +28 -0
  31. data/doc/index.html +103 -0
  32. data/doc/js/app.js +214 -0
  33. data/doc/js/full_list.js +173 -0
  34. data/doc/js/jquery.js +4 -0
  35. data/doc/method_list.html +620 -0
  36. data/doc/top-level-namespace.html +112 -0
  37. data/lib/cowtech-extensions.rb +47 -16
  38. data/lib/cowtech-extensions/boolean.rb +8 -1
  39. data/lib/cowtech-extensions/datetime.rb +377 -71
  40. data/lib/cowtech-extensions/exceptions.rb +16 -0
  41. data/lib/cowtech-extensions/hash.rb +20 -9
  42. data/lib/cowtech-extensions/math.rb +15 -8
  43. data/lib/cowtech-extensions/object.rb +84 -27
  44. data/lib/cowtech-extensions/pathname.rb +10 -1
  45. data/lib/cowtech-extensions/settings.rb +120 -0
  46. data/lib/cowtech-extensions/string.rb +30 -3
  47. data/lib/cowtech-extensions/version.rb +11 -2
  48. data/spec/coverage_helper.rb +19 -0
  49. data/spec/cowtech-extensions/boolean_spec.rb +4 -0
  50. data/spec/cowtech-extensions/datetime_spec.rb +238 -79
  51. data/spec/cowtech-extensions/hash_spec.rb +5 -2
  52. data/spec/cowtech-extensions/math_spec.rb +14 -4
  53. data/spec/cowtech-extensions/object_spec.rb +19 -1
  54. data/spec/cowtech-extensions/pathname_spec.rb +5 -1
  55. data/spec/cowtech-extensions/settings_spec.rb +101 -0
  56. data/spec/cowtech-extensions/string_spec.rb +13 -0
  57. data/spec/cowtech-extensions_spec.rb +33 -13
  58. data/spec/spec_helper.rb +2 -5
  59. metadata +182 -97
  60. data/lib/cowtech-extensions/utils.rb +0 -74
@@ -0,0 +1,471 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Cowtech::Extensions::String
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../../';
20
+ framesUrl = "../../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../../_index.html">Index (S)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Cowtech.html" title="Cowtech (module)">Cowtech</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Extensions.html" title="Cowtech::Extensions (module)">Extensions</a></span></span>
36
+ &raquo;
37
+ <span class="title">String</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: Cowtech::Extensions::String
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+ <dt class="r1">Extended by:</dt>
77
+ <dd class="r1">ActiveSupport::Concern</dd>
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+ <dt class="r2 last">Defined in:</dt>
86
+ <dd class="r2 last">lib/cowtech-extensions/string.rb</dd>
87
+
88
+ </dl>
89
+ <div class="clear"></div>
90
+
91
+ <h2>Overview</h2><div class="docstring">
92
+ <div class="discussion">
93
+ <p>Extensions for the String class.</p>
94
+
95
+
96
+ </div>
97
+ </div>
98
+ <div class="tags">
99
+
100
+
101
+ </div>
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <h2>
110
+ Instance Method Summary
111
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
112
+ </h2>
113
+
114
+ <ul class="summary">
115
+
116
+ <li class="public ">
117
+ <span class="summary_signature">
118
+
119
+ <a href="#remove_accents-instance_method" title="#remove_accents (instance method)">- (Object) <strong>remove_accents</strong> </a>
120
+
121
+
122
+
123
+ </span>
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <span class="summary_desc"><div class='inline'><p>Removes accents from the string, normalizing to the normal letter.</p>
134
+ </div></span>
135
+
136
+ </li>
137
+
138
+
139
+ <li class="public ">
140
+ <span class="summary_signature">
141
+
142
+ <a href="#replace_ampersands-instance_method" title="#replace_ampersands (instance method)">- (String) <strong>replace_ampersands</strong> </a>
143
+
144
+
145
+
146
+ </span>
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ <span class="summary_desc"><div class='inline'><p>Returns the string with all <code>&amp;amp;</code> replaced with <code>&amp;</code>.</p>
157
+ </div></span>
158
+
159
+ </li>
160
+
161
+
162
+ <li class="public ">
163
+ <span class="summary_signature">
164
+
165
+ <a href="#untitleize-instance_method" title="#untitleize (instance method)">- (String) <strong>untitleize</strong> </a>
166
+
167
+
168
+
169
+ </span>
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+ <span class="summary_desc"><div class='inline'><p>Returns the tagged version of a string.</p>
180
+ </div></span>
181
+
182
+ </li>
183
+
184
+
185
+ <li class="public ">
186
+ <span class="summary_signature">
187
+
188
+ <a href="#value-instance_method" title="#value (instance method)">- (String) <strong>value</strong> </a>
189
+
190
+
191
+
192
+ </span>
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ <span class="summary_desc"><div class='inline'><p>Returns the string itself for use in form helpers.</p>
203
+ </div></span>
204
+
205
+ </li>
206
+
207
+
208
+ </ul>
209
+
210
+
211
+
212
+
213
+
214
+ <div id="instance_method_details" class="method_details_list">
215
+ <h2>Instance Method Details</h2>
216
+
217
+
218
+ <div class="method_details first">
219
+ <h3 class="signature first" id="remove_accents-instance_method">
220
+
221
+ - (<tt><span class='object_link'><a href="Object.html" title="Cowtech::Extensions::Object (module)">Object</a></span></tt>) <strong>remove_accents</strong>
222
+
223
+
224
+
225
+
226
+
227
+ </h3><div class="docstring">
228
+ <div class="discussion">
229
+ <p>Removes accents from the string, normalizing to the normal letter.</p>
230
+
231
+ <pre class="code ruby"><code><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>èòàù</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_remove_accents'>remove_accents</span>
232
+ <span class='comment'># =&gt; &quot;eoau&quot;
233
+ </span></code></pre>
234
+
235
+
236
+ </div>
237
+ </div>
238
+ <div class="tags">
239
+
240
+ <p class="tag_title">Returns:</p>
241
+ <ul class="return">
242
+
243
+ <li>
244
+
245
+
246
+ <span class='type'></span>
247
+
248
+
249
+
250
+
251
+ <div class='inline'><p>The string with all accents removed.</p>
252
+ </div>
253
+
254
+ </li>
255
+
256
+ </ul>
257
+
258
+ </div><table class="source_code">
259
+ <tr>
260
+ <td>
261
+ <pre class="lines">
262
+
263
+
264
+ 21
265
+ 22
266
+ 23
267
+ 24
268
+ 25</pre>
269
+ </td>
270
+ <td>
271
+ <pre class="code"><span class="info file"># File 'lib/cowtech-extensions/string.rb', line 21</span>
272
+
273
+ <span class='kw'>def</span> <span class='id identifier rubyid_remove_accents'>remove_accents</span>
274
+ <span class='id identifier rubyid_silence_warnings'>silence_warnings</span> <span class='lbrace'>{</span>
275
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_mb_chars'>mb_chars</span><span class='period'>.</span><span class='id identifier rubyid_normalize'>normalize</span><span class='lparen'>(</span><span class='symbol'>:kd</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[^\x00-\x7F]</span><span class='regexp_end'>/n</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
276
+ <span class='rbrace'>}</span>
277
+ <span class='kw'>end</span></pre>
278
+ </td>
279
+ </tr>
280
+ </table>
281
+ </div>
282
+
283
+ <div class="method_details ">
284
+ <h3 class="signature " id="replace_ampersands-instance_method">
285
+
286
+ - (<tt><span class='object_link'><a href="" title="Cowtech::Extensions::String (module)">String</a></span></tt>) <strong>replace_ampersands</strong>
287
+
288
+
289
+
290
+
291
+
292
+ </h3><div class="docstring">
293
+ <div class="discussion">
294
+ <p>Returns the string with all <code>&amp;amp;</code> replaced with <code>&amp;</code>.</p>
295
+
296
+
297
+ </div>
298
+ </div>
299
+ <div class="tags">
300
+
301
+ <p class="tag_title">Returns:</p>
302
+ <ul class="return">
303
+
304
+ <li>
305
+
306
+
307
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
308
+
309
+
310
+
311
+ &mdash;
312
+ <div class='inline'><p>The string with all <code>&amp;amp;</code> replaced with <code>&amp;</code>.</p>
313
+ </div>
314
+
315
+ </li>
316
+
317
+ </ul>
318
+
319
+ </div><table class="source_code">
320
+ <tr>
321
+ <td>
322
+ <pre class="lines">
323
+
324
+
325
+ 44
326
+ 45
327
+ 46</pre>
328
+ </td>
329
+ <td>
330
+ <pre class="code"><span class="info file"># File 'lib/cowtech-extensions/string.rb', line 44</span>
331
+
332
+ <span class='kw'>def</span> <span class='id identifier rubyid_replace_ampersands'>replace_ampersands</span>
333
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>&amp;amp;(\S+);</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&amp;\\1;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
334
+ <span class='kw'>end</span></pre>
335
+ </td>
336
+ </tr>
337
+ </table>
338
+ </div>
339
+
340
+ <div class="method_details ">
341
+ <h3 class="signature " id="untitleize-instance_method">
342
+
343
+ - (<tt><span class='object_link'><a href="" title="Cowtech::Extensions::String (module)">String</a></span></tt>) <strong>untitleize</strong>
344
+
345
+
346
+
347
+
348
+
349
+ </h3><div class="docstring">
350
+ <div class="discussion">
351
+ <p>Returns the tagged version of a string.</p>
352
+
353
+ <p>The string is downcased and spaces are substituted with <code>-</code>.</p>
354
+
355
+ <pre class="code ruby"><code><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ABC cde</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_untitleize'>untitleize</span>
356
+ <span class='comment'># =&gt; &quot;abc-cde&quot;
357
+ </span></code></pre>
358
+
359
+
360
+ </div>
361
+ </div>
362
+ <div class="tags">
363
+
364
+ <p class="tag_title">Returns:</p>
365
+ <ul class="return">
366
+
367
+ <li>
368
+
369
+
370
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
371
+
372
+
373
+
374
+ &mdash;
375
+ <div class='inline'><p>The untitleized version of the string.</p>
376
+ </div>
377
+
378
+ </li>
379
+
380
+ </ul>
381
+
382
+ </div><table class="source_code">
383
+ <tr>
384
+ <td>
385
+ <pre class="lines">
386
+
387
+
388
+ 37
389
+ 38
390
+ 39</pre>
391
+ </td>
392
+ <td>
393
+ <pre class="code"><span class="info file"># File 'lib/cowtech-extensions/string.rb', line 37</span>
394
+
395
+ <span class='kw'>def</span> <span class='id identifier rubyid_untitleize'>untitleize</span>
396
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> </span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>-</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
397
+ <span class='kw'>end</span></pre>
398
+ </td>
399
+ </tr>
400
+ </table>
401
+ </div>
402
+
403
+ <div class="method_details ">
404
+ <h3 class="signature " id="value-instance_method">
405
+
406
+ - (<tt><span class='object_link'><a href="" title="Cowtech::Extensions::String (module)">String</a></span></tt>) <strong>value</strong>
407
+
408
+
409
+
410
+
411
+
412
+ </h3><div class="docstring">
413
+ <div class="discussion">
414
+ <p>Returns the string itself for use in form helpers.</p>
415
+
416
+
417
+ </div>
418
+ </div>
419
+ <div class="tags">
420
+
421
+ <p class="tag_title">Returns:</p>
422
+ <ul class="return">
423
+
424
+ <li>
425
+
426
+
427
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
428
+
429
+
430
+
431
+ &mdash;
432
+ <div class='inline'><p>The string itself.</p>
433
+ </div>
434
+
435
+ </li>
436
+
437
+ </ul>
438
+
439
+ </div><table class="source_code">
440
+ <tr>
441
+ <td>
442
+ <pre class="lines">
443
+
444
+
445
+ 51
446
+ 52
447
+ 53</pre>
448
+ </td>
449
+ <td>
450
+ <pre class="code"><span class="info file"># File 'lib/cowtech-extensions/string.rb', line 51</span>
451
+
452
+ <span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
453
+ <span class='kw'>self</span>
454
+ <span class='kw'>end</span></pre>
455
+ </td>
456
+ </tr>
457
+ </table>
458
+ </div>
459
+
460
+ </div>
461
+
462
+ </div>
463
+
464
+ <div id="footer">
465
+ Generated on Thu Jul 19 17:17:50 2012 by
466
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
467
+ 0.8.2.1 (ruby-1.9.2).
468
+ </div>
469
+
470
+ </body>
471
+ </html>