cowtech-extensions 2.5.1 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/Cowtech.html +2 -2
- data/doc/Cowtech/Extensions.html +83 -86
- data/doc/Cowtech/Extensions/Boolean.html +8 -10
- data/doc/Cowtech/Extensions/DateTime.html +52 -58
- data/doc/Cowtech/Extensions/DateTime/ClassMethods.html +79 -91
- data/doc/Cowtech/Extensions/Exceptions.html +2 -2
- data/doc/Cowtech/Extensions/Exceptions/Dump.html +2 -2
- data/doc/Cowtech/Extensions/Hash.html +18 -20
- data/doc/Cowtech/Extensions/Math.html +2 -2
- data/doc/Cowtech/Extensions/Math/ClassMethods.html +22 -24
- data/doc/Cowtech/Extensions/Object.html +81 -95
- data/doc/Cowtech/Extensions/Pathname.html +10 -11
- data/doc/Cowtech/Extensions/Settings.html +70 -80
- data/doc/Cowtech/Extensions/String.html +22 -26
- data/doc/Cowtech/Extensions/TimeZone.html +205 -92
- data/doc/Cowtech/Extensions/TimeZone/ClassMethods.html +59 -65
- data/doc/Cowtech/Extensions/Version.html +6 -10
- data/doc/_index.html +2 -2
- data/doc/file.README.html +5 -5
- data/doc/index.html +5 -5
- data/doc/method_list.html +82 -74
- data/doc/top-level-namespace.html +2 -2
- data/lib/cowtech-extensions/datetime.rb +16 -5
- data/lib/cowtech-extensions/settings.rb +5 -5
- data/lib/cowtech-extensions/version.rb +2 -2
- data/spec/cowtech-extensions/datetime_spec.rb +12 -3
- metadata +120 -138
@@ -116,9 +116,9 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on Fri Jul 20
|
119
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
|
-
0.8.2.1 (ruby-1.
|
121
|
+
0.8.2.1 (ruby-1.9.2).
|
122
122
|
</div>
|
123
123
|
|
124
124
|
</body>
|
@@ -124,9 +124,9 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on Fri Jul 20
|
127
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
|
-
0.8.2.1 (ruby-1.
|
129
|
+
0.8.2.1 (ruby-1.9.2).
|
130
130
|
</div>
|
131
131
|
|
132
132
|
</body>
|
@@ -278,20 +278,19 @@
|
|
278
278
|
<td>
|
279
279
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/hash.rb', line 19</span>
|
280
280
|
|
281
|
-
<span class='
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
<span class='
|
294
|
-
</pre>
|
281
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
282
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
283
|
+
|
284
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
285
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
286
|
+
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
287
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbracket'>]</span>
|
288
|
+
<span class='kw'>else</span>
|
289
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
290
|
+
<span class='kw'>end</span>
|
291
|
+
|
292
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
293
|
+
<span class='kw'>end</span></pre>
|
295
294
|
</td>
|
296
295
|
</tr>
|
297
296
|
</table>
|
@@ -372,10 +371,9 @@
|
|
372
371
|
<td>
|
373
372
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/hash.rb', line 37</span>
|
374
373
|
|
375
|
-
<span class='
|
376
|
-
|
377
|
-
<span class='
|
378
|
-
</pre>
|
374
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span>
|
375
|
+
<span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='op'>::</span><span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span>
|
376
|
+
<span class='kw'>end</span></pre>
|
379
377
|
</td>
|
380
378
|
</tr>
|
381
379
|
</table>
|
@@ -386,9 +384,9 @@
|
|
386
384
|
</div>
|
387
385
|
|
388
386
|
<div id="footer">
|
389
|
-
Generated on Fri Jul 20
|
387
|
+
Generated on Fri Jul 20 14:28:06 2012 by
|
390
388
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
391
|
-
0.8.2.1 (ruby-1.
|
389
|
+
0.8.2.1 (ruby-1.9.2).
|
392
390
|
</div>
|
393
391
|
|
394
392
|
</body>
|
@@ -121,9 +121,9 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on Fri Jul 20
|
124
|
+
Generated on Fri Jul 20 14:28:06 2012 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
|
-
0.8.2.1 (ruby-1.
|
126
|
+
0.8.2.1 (ruby-1.9.2).
|
127
127
|
</div>
|
128
128
|
|
129
129
|
</body>
|
@@ -240,18 +240,17 @@
|
|
240
240
|
<td>
|
241
241
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/math.rb', line 35</span>
|
242
242
|
|
243
|
-
<span class='
|
244
|
-
<span class='
|
245
|
-
|
246
|
-
<span class='
|
247
|
-
<span class='
|
248
|
-
<span class='
|
249
|
-
<span class='
|
250
|
-
<span class='
|
251
|
-
|
252
|
-
<span class='
|
253
|
-
<span class='
|
254
|
-
</pre>
|
243
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_max'>max</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
244
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
245
|
+
|
246
|
+
<span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
|
247
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>0</span> <span class='kw'>then</span>
|
248
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
249
|
+
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_a'>a</span> <span class='kw'>if</span> <span class='id identifier rubyid_a'>a</span> <span class='op'>></span> <span class='id identifier rubyid_rv'>rv</span> <span class='kw'>end</span>
|
250
|
+
<span class='kw'>end</span>
|
251
|
+
|
252
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
253
|
+
<span class='kw'>end</span></pre>
|
255
254
|
</td>
|
256
255
|
</tr>
|
257
256
|
</table>
|
@@ -333,18 +332,17 @@
|
|
333
332
|
<td>
|
334
333
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/math.rb', line 19</span>
|
335
334
|
|
336
|
-
<span class='
|
337
|
-
<span class='
|
335
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_min'>min</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
336
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
338
337
|
|
339
|
-
<span class='
|
340
|
-
<span class='
|
341
|
-
<span class='
|
342
|
-
<span class='
|
343
|
-
<span class='
|
338
|
+
<span class='id identifier rubyid_args'>args</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
|
339
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>0</span> <span class='kw'>then</span>
|
340
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
341
|
+
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_a'>a</span> <span class='kw'>if</span> <span class='id identifier rubyid_a'>a</span> <span class='op'><</span> <span class='id identifier rubyid_rv'>rv</span> <span class='kw'>end</span>
|
342
|
+
<span class='kw'>end</span>
|
344
343
|
|
345
|
-
<span class='
|
346
|
-
<span class='
|
347
|
-
</pre>
|
344
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
345
|
+
<span class='kw'>end</span></pre>
|
348
346
|
</td>
|
349
347
|
</tr>
|
350
348
|
</table>
|
@@ -355,9 +353,9 @@
|
|
355
353
|
</div>
|
356
354
|
|
357
355
|
<div id="footer">
|
358
|
-
Generated on Fri Jul 20
|
356
|
+
Generated on Fri Jul 20 14:28:06 2012 by
|
359
357
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
360
|
-
0.8.2.1 (ruby-1.
|
358
|
+
0.8.2.1 (ruby-1.9.2).
|
361
359
|
</div>
|
362
360
|
|
363
361
|
</body>
|
@@ -549,22 +549,21 @@
|
|
549
549
|
<td>
|
550
550
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 148</span>
|
551
551
|
|
552
|
-
<span class='
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
<span class='
|
567
|
-
</pre>
|
552
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_debug_dump'>debug_dump</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='symbol'>:yaml</span><span class='comma'>,</span> <span class='id identifier rubyid_must_raise'>must_raise</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
553
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
554
|
+
|
555
|
+
<span class='kw'>begin</span>
|
556
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>==</span> <span class='symbol'>:pretty_json</span> <span class='kw'>then</span>
|
557
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
558
|
+
<span class='kw'>else</span>
|
559
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>to_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
560
|
+
<span class='kw'>end</span>
|
561
|
+
<span class='kw'>rescue</span>
|
562
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
|
563
|
+
<span class='kw'>end</span>
|
564
|
+
|
565
|
+
<span class='id identifier rubyid_must_raise'>must_raise</span> <span class='op'>?</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Dump</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
566
|
+
<span class='kw'>end</span></pre>
|
568
567
|
</td>
|
569
568
|
</tr>
|
570
569
|
</table>
|
@@ -619,10 +618,9 @@
|
|
619
618
|
<td>
|
620
619
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 55</span>
|
621
620
|
|
622
|
-
<span class='
|
623
|
-
|
624
|
-
<span class='
|
625
|
-
</pre>
|
621
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_ensure_array'>ensure_array</span>
|
622
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Array</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
|
623
|
+
<span class='kw'>end</span></pre>
|
626
624
|
</td>
|
627
625
|
</tr>
|
628
626
|
</table>
|
@@ -677,10 +675,9 @@
|
|
677
675
|
<td>
|
678
676
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 62</span>
|
679
677
|
|
680
|
-
<span class='
|
681
|
-
|
682
|
-
<span class='
|
683
|
-
</pre>
|
678
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
679
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
680
|
+
<span class='kw'>end</span></pre>
|
684
681
|
</td>
|
685
682
|
</tr>
|
686
683
|
</table>
|
@@ -785,15 +782,14 @@
|
|
785
782
|
<td>
|
786
783
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 134</span>
|
787
784
|
|
788
|
-
<span class='
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
785
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_format_boolean'>format_boolean</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
786
|
+
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
787
|
+
<span class='kw'>true</span> <span class='op'>=></span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_boolean_names'>boolean_names</span><span class='lbracket'>[</span><span class='kw'>true</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
788
|
+
<span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_boolean_names'>boolean_names</span><span class='lbracket'>[</span><span class='kw'>false</span><span class='rbracket'>]</span>
|
789
|
+
<span class='rbrace'>}</span>
|
793
790
|
|
794
|
-
|
795
|
-
<span class='
|
796
|
-
</pre>
|
791
|
+
<span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='rbracket'>]</span>
|
792
|
+
<span class='kw'>end</span></pre>
|
797
793
|
</td>
|
798
794
|
</tr>
|
799
795
|
</table>
|
@@ -932,15 +928,14 @@
|
|
932
928
|
<td>
|
933
929
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 119</span>
|
934
930
|
|
935
|
-
<span class='
|
936
|
-
<span class='
|
937
|
-
<span class='
|
938
|
-
<span class='
|
939
|
-
<span class='
|
931
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_format_number'>format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
932
|
+
<span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_format_number'>format_number</span><span class='lbracket'>[</span><span class='symbol'>:prec</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_prec'>prec</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
933
|
+
<span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_format_number'>format_number</span><span class='lbracket'>[</span><span class='symbol'>:decimal_separator</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
934
|
+
<span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_format_number'>format_number</span><span class='lbracket'>[</span><span class='symbol'>:add_string</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
935
|
+
<span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_format_number'>format_number</span><span class='lbracket'>[</span><span class='symbol'>:k_separator</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
940
936
|
|
941
|
-
<span class='lparen
|
942
|
-
<span class='
|
943
|
-
</pre>
|
937
|
+
<span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_number?'>is_number?</span> <span class='op'>&&</span> <span class='id identifier rubyid_prec'>prec</span> <span class='op'>>=</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_number_to_currency'>number_to_currency</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:precision</span> <span class='op'>=></span> <span class='id identifier rubyid_prec'>prec</span><span class='comma'>,</span> <span class='symbol'>:separator</span> <span class='op'>=></span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='symbol'>:delimiter</span> <span class='op'>=></span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='comma'>,</span> <span class='symbol'>:format</span> <span class='op'>=></span> <span class='id identifier rubyid_add_string'>add_string</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%n</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%n %u</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:unit</span> <span class='op'>=></span> <span class='id identifier rubyid_add_string'>add_string</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
938
|
+
<span class='kw'>end</span></pre>
|
944
939
|
</td>
|
945
940
|
</tr>
|
946
941
|
</table>
|
@@ -995,10 +990,9 @@
|
|
995
990
|
<td>
|
996
991
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 48</span>
|
997
992
|
|
998
|
-
<span class='
|
999
|
-
|
1000
|
-
<span class='
|
1001
|
-
</pre>
|
993
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_boolean?'>is_boolean?</span>
|
994
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>TrueClass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>FalseClass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>NilClass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(1|0|true|false|yes|no|t|f|y|n)$</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span>
|
995
|
+
<span class='kw'>end</span></pre>
|
1002
996
|
</td>
|
1003
997
|
</tr>
|
1004
998
|
</table>
|
@@ -1053,10 +1047,9 @@
|
|
1053
1047
|
<td>
|
1054
1048
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 41</span>
|
1055
1049
|
|
1056
|
-
<span class='
|
1057
|
-
|
1058
|
-
<span class='
|
1059
|
-
</pre>
|
1050
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_float?'>is_float?</span>
|
1051
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Float</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^([+-]?)(\d+)([.,]\d+)?$</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_number'>normalize_number</span><span class='rparen'>)</span>
|
1052
|
+
<span class='kw'>end</span></pre>
|
1060
1053
|
</td>
|
1061
1054
|
</tr>
|
1062
1055
|
</table>
|
@@ -1111,10 +1104,9 @@
|
|
1111
1104
|
<td>
|
1112
1105
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 34</span>
|
1113
1106
|
|
1114
|
-
<span class='
|
1115
|
-
|
1116
|
-
<span class='
|
1117
|
-
</pre>
|
1107
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_integer?'>is_integer?</span>
|
1108
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Integer</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^([+-]?)(\d+)$</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_number'>normalize_number</span><span class='rparen'>)</span>
|
1109
|
+
<span class='kw'>end</span></pre>
|
1118
1110
|
</td>
|
1119
1111
|
</tr>
|
1120
1112
|
</table>
|
@@ -1169,10 +1161,9 @@
|
|
1169
1161
|
<td>
|
1170
1162
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 27</span>
|
1171
1163
|
|
1172
|
-
<span class='
|
1173
|
-
|
1174
|
-
<span class='
|
1175
|
-
</pre>
|
1164
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_number?'>is_number?</span>
|
1165
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_float?'>is_float?</span>
|
1166
|
+
<span class='kw'>end</span></pre>
|
1176
1167
|
</td>
|
1177
1168
|
</tr>
|
1178
1169
|
</table>
|
@@ -1230,13 +1221,12 @@
|
|
1230
1221
|
<td>
|
1231
1222
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 17</span>
|
1232
1223
|
|
1233
|
-
<span class='
|
1234
|
-
<span class='
|
1235
|
-
<span class='
|
1236
|
-
<span class='
|
1237
|
-
<span class='
|
1238
|
-
<span class='
|
1239
|
-
</pre>
|
1224
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_normalize_number'>normalize_number</span>
|
1225
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
1226
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[\.,]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
|
1227
|
+
<span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>1</span>
|
1228
|
+
<span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1229
|
+
<span class='kw'>end</span></pre>
|
1240
1230
|
</td>
|
1241
1231
|
</tr>
|
1242
1232
|
</table>
|
@@ -1312,10 +1302,9 @@
|
|
1312
1302
|
<td>
|
1313
1303
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 107</span>
|
1314
1304
|
|
1315
|
-
<span class='
|
1316
|
-
|
1317
|
-
<span class='
|
1318
|
-
</pre>
|
1305
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_round_to_precision'>round_to_precision</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='rparen'>)</span>
|
1306
|
+
<span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_number?'>is_number?</span> <span class='op'>&&</span> <span class='id identifier rubyid_prec'>prec</span> <span class='op'>>=</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_number_with_precision'>number_with_precision</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='symbol'>:precision</span> <span class='op'>=></span> <span class='id identifier rubyid_prec'>prec</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1307
|
+
<span class='kw'>end</span></pre>
|
1319
1308
|
</td>
|
1320
1309
|
</tr>
|
1321
1310
|
</table>
|
@@ -1372,12 +1361,11 @@
|
|
1372
1361
|
<td>
|
1373
1362
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 97</span>
|
1374
1363
|
|
1375
|
-
<span class='
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
<span class='
|
1380
|
-
</pre>
|
1364
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_boolean'>to_boolean</span>
|
1365
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span>
|
1366
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Float</span><span class='rparen'>)</span>
|
1367
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>TrueClass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(1|on|true|yes|t|y)$</span><span class='regexp_end'>/i</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
|
1368
|
+
<span class='kw'>end</span></pre>
|
1381
1369
|
</td>
|
1382
1370
|
</tr>
|
1383
1371
|
</table>
|
@@ -1459,16 +1447,15 @@
|
|
1459
1447
|
<td>
|
1460
1448
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 70</span>
|
1461
1449
|
|
1462
|
-
<span class='
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
<span class='
|
1471
|
-
</pre>
|
1450
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_float'>to_float</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='float'>0.0</span><span class='rparen'>)</span>
|
1451
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Float</span><span class='rparen'>)</span>
|
1452
|
+
<span class='kw'>self</span>
|
1453
|
+
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Integer</span><span class='rparen'>)</span>
|
1454
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
|
1455
|
+
<span class='kw'>else</span>
|
1456
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_float?'>is_float?</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>Kernel</span><span class='period'>.</span><span class='const'>Float</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_number'>normalize_number</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_default_value'>default_value</span>
|
1457
|
+
<span class='kw'>end</span>
|
1458
|
+
<span class='kw'>end</span></pre>
|
1472
1459
|
</td>
|
1473
1460
|
</tr>
|
1474
1461
|
</table>
|
@@ -1550,16 +1537,15 @@
|
|
1550
1537
|
<td>
|
1551
1538
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 84</span>
|
1552
1539
|
|
1553
|
-
<span class='
|
1554
|
-
<span class='
|
1555
|
-
<span class='
|
1556
|
-
<span class='
|
1557
|
-
<span class='
|
1558
|
-
<span class='
|
1559
|
-
<span class='
|
1560
|
-
<span class='
|
1561
|
-
<span class='
|
1562
|
-
</pre>
|
1540
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_integer'>to_integer</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='int'>0</span><span class='rparen'>)</span>
|
1541
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Integer</span><span class='rparen'>)</span>
|
1542
|
+
<span class='kw'>self</span>
|
1543
|
+
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Float</span><span class='rparen'>)</span>
|
1544
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
1545
|
+
<span class='kw'>else</span>
|
1546
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_integer?'>is_integer?</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>Kernel</span><span class='period'>.</span><span class='const'>Integer</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_number'>normalize_number</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_default_value'>default_value</span>
|
1547
|
+
<span class='kw'>end</span>
|
1548
|
+
<span class='kw'>end</span></pre>
|
1563
1549
|
</td>
|
1564
1550
|
</tr>
|
1565
1551
|
</table>
|
@@ -1570,9 +1556,9 @@
|
|
1570
1556
|
</div>
|
1571
1557
|
|
1572
1558
|
<div id="footer">
|
1573
|
-
Generated on Fri Jul 20
|
1559
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
1574
1560
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1575
|
-
0.8.2.1 (ruby-1.
|
1561
|
+
0.8.2.1 (ruby-1.9.2).
|
1576
1562
|
</div>
|
1577
1563
|
|
1578
1564
|
</body>
|
@@ -159,9 +159,9 @@
|
|
159
159
|
<div class="discussion">
|
160
160
|
<p>Returns all the components that are included in this path.</p>
|
161
161
|
|
162
|
-
<pre class="code ruby"><code><span class='
|
163
|
-
<span class='comment
|
164
|
-
</code></pre>
|
162
|
+
<pre class="code ruby"><code><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/usr/bin/ruby</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_components'>components</span>
|
163
|
+
<span class='comment'># => ["usr", "bin", "ruby"]
|
164
|
+
</span></code></pre>
|
165
165
|
|
166
166
|
|
167
167
|
</div>
|
@@ -201,12 +201,11 @@
|
|
201
201
|
<td>
|
202
202
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/pathname.rb', line 21</span>
|
203
203
|
|
204
|
-
<span class='
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
<span class='
|
209
|
-
</pre>
|
204
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_components'>components</span>
|
205
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
206
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each_filename'>each_filename</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'><<</span> <span class='id identifier rubyid_p'>p</span> <span class='rbrace'>}</span>
|
207
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
208
|
+
<span class='kw'>end</span></pre>
|
210
209
|
</td>
|
211
210
|
</tr>
|
212
211
|
</table>
|
@@ -217,9 +216,9 @@
|
|
217
216
|
</div>
|
218
217
|
|
219
218
|
<div id="footer">
|
220
|
-
Generated on Fri Jul 20
|
219
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
221
220
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
222
|
-
0.8.2.1 (ruby-1.
|
221
|
+
0.8.2.1 (ruby-1.9.2).
|
223
222
|
</div>
|
224
223
|
|
225
224
|
</body>
|