cowtech-extensions 2.7.1 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.travis.yml +4 -2
- data/README.md +4 -1
- data/doc/Cowtech.html +2 -2
- data/doc/Cowtech/Extensions.html +96 -93
- data/doc/Cowtech/Extensions/Boolean.html +10 -8
- data/doc/Cowtech/Extensions/DateTime.html +58 -52
- data/doc/Cowtech/Extensions/DateTime/ClassMethods.html +91 -79
- data/doc/Cowtech/Extensions/Exceptions.html +2 -2
- data/doc/Cowtech/Extensions/Exceptions/Dump.html +2 -2
- data/doc/Cowtech/Extensions/Hash.html +20 -18
- data/doc/Cowtech/Extensions/Math.html +2 -2
- data/doc/Cowtech/Extensions/Math/ClassMethods.html +24 -22
- data/doc/Cowtech/Extensions/Object.html +95 -81
- data/doc/Cowtech/Extensions/Pathname.html +11 -10
- data/doc/Cowtech/Extensions/Settings.html +80 -70
- data/doc/Cowtech/Extensions/String.html +26 -22
- data/doc/Cowtech/Extensions/TimeZone.html +98 -86
- data/doc/Cowtech/Extensions/TimeZone/ClassMethods.html +79 -72
- data/doc/Cowtech/Extensions/Version.html +11 -7
- data/doc/_index.html +2 -2
- data/doc/file.README.html +9 -6
- data/doc/index.html +9 -6
- data/doc/top-level-namespace.html +2 -2
- data/lib/cowtech-extensions.rb +2 -1
- data/lib/cowtech-extensions/version.rb +2 -2
- data/spec/cowtech-extensions/boolean_spec.rb +9 -4
- data/spec/cowtech-extensions/datetime_spec.rb +106 -100
- data/spec/cowtech-extensions/hash_spec.rb +4 -4
- data/spec/cowtech-extensions/math_spec.rb +8 -8
- data/spec/cowtech-extensions/object_spec.rb +115 -103
- data/spec/cowtech-extensions/pathname_spec.rb +3 -1
- data/spec/cowtech-extensions/settings_spec.rb +30 -30
- data/spec/cowtech-extensions/string_spec.rb +13 -7
- data/spec/cowtech-extensions_spec.rb +21 -11
- data/spec/spec_helper.rb +7 -1
- metadata +4 -4
@@ -469,9 +469,10 @@
|
|
469
469
|
<td>
|
470
470
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 152</span>
|
471
471
|
|
472
|
-
<span class='kw'>def</span> <span class='
|
473
|
-
<span class='op'>::</span><span class='
|
474
|
-
<span class='kw'>end</span
|
472
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_custom_format identifier id'>custom_format</span><span class='lparen token'>(</span><span class='rubyid_key identifier id'>key</span><span class='rparen token'>)</span>
|
473
|
+
<span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_date_formats identifier id'>date_formats</span><span class='dot token'>.</span><span class='rubyid_fetch identifier id'>fetch</span><span class='lparen token'>(</span><span class='rubyid_key identifier id'>key</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='comma token'>,</span> <span class='rubyid_key identifier id'>key</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span>
|
474
|
+
<span class='rubyid_end end kw'>end</span>
|
475
|
+
</pre>
|
475
476
|
</td>
|
476
477
|
</tr>
|
477
478
|
</table>
|
@@ -558,13 +559,14 @@
|
|
558
559
|
<td>
|
559
560
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 20</span>
|
560
561
|
|
561
|
-
<span class='kw'>def</span> <span class='
|
562
|
-
<span class='
|
563
|
-
<span class='lparen'>(</span><span class='
|
564
|
-
<span class='lbrace'>{</span><span class='symbol'>:value</span> <span class='op'
|
565
|
-
<span class='rbrace'>}</span>
|
562
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_days identifier id'>days</span><span class='lparen token'>(</span><span class='rubyid_short identifier id'>short</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span>
|
563
|
+
<span class='rubyid_days identifier id'>days</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_date_names identifier id'>date_names</span><span class='lbrack token'>[</span><span class='rubyid_short identifier id'>short</span> <span class='integer val'>? </span><span class='symbol val'>:short_days</span> <span class='colon op'>:</span> <span class='symbol val'>:long_days</span><span class='rbrack token'>]</span>
|
564
|
+
<span class='lparen token'>(</span><span class='float val'>1</span><span class='dot2 op'>..</span><span class='integer val'>7</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_to_a identifier id'>to_a</span><span class='dot token'>.</span><span class='rubyid_collect identifier id'>collect</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='rubyid_i identifier id'>i</span><span class='bitor op'>|</span>
|
565
|
+
<span class='lbrace token'>{</span><span class='symbol val'>:value</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_i identifier id'>i</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span><span class='comma token'>,</span> <span class='symbol val'>:label=</span><span class='gt op'>></span> <span class='rubyid_days identifier id'>days</span><span class='lbrack token'>[</span><span class='rubyid_i identifier id'>i</span> <span class='minus op'>-</span> <span class='integer val'>1</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span>
|
566
|
+
<span class='rbrace token'>}</span>
|
566
567
|
|
567
|
-
<span class='kw'>end</span
|
568
|
+
<span class='rubyid_end end kw'>end</span>
|
569
|
+
</pre>
|
568
570
|
</td>
|
569
571
|
</tr>
|
570
572
|
</table>
|
@@ -665,27 +667,28 @@
|
|
665
667
|
<td>
|
666
668
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 125</span>
|
667
669
|
|
668
|
-
<span class='kw'>def</span> <span class='
|
669
|
-
<span class='
|
670
|
-
|
671
|
-
<span class='comment'># Compute using Anonymouse Gregorian Algorithm: http://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm
|
672
|
-
|
673
|
-
<span class='
|
674
|
-
<span class='
|
675
|
-
<span class='
|
676
|
-
<span class='
|
677
|
-
<span class='
|
678
|
-
<span class='
|
679
|
-
<span class='
|
680
|
-
<span class='
|
681
|
-
<span class='
|
682
|
-
<span class='
|
683
|
-
<span class='
|
684
|
-
|
685
|
-
<span class='
|
686
|
-
<span class='
|
687
|
-
<span class='op'>::</span><span class='
|
688
|
-
<span class='kw'>end</span
|
670
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_easter identifier id'>easter</span><span class='lparen token'>(</span><span class='rubyid_year identifier id'>year</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
671
|
+
<span class='rubyid_year identifier id'>year</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_Date constant id'>Date</span><span class='dot token'>.</span><span class='rubyid_today identifier id'>today</span><span class='dot token'>.</span><span class='rubyid_year identifier id'>year</span> <span class='rubyid_if if_mod kw'>if</span> <span class='notop op'>!</span><span class='rubyid_year identifier id'>year</span><span class='dot token'>.</span><span class='rubyid_is_integer? fid id'>is_integer?</span>
|
672
|
+
|
673
|
+
<span class='comment val'># Compute using Anonymouse Gregorian Algorithm: http://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm</span>
|
674
|
+
<span class='rubyid_a identifier id'>a</span> <span class='assign token'>=</span> <span class='rubyid_year identifier id'>year</span> <span class='mod op'>%</span> <span class='integer val'>19</span>
|
675
|
+
<span class='rubyid_b identifier id'>b</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_year identifier id'>year</span> <span class='div op'>/</span> <span class='float val'>100.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_floor identifier id'>floor</span>
|
676
|
+
<span class='rubyid_c identifier id'>c</span> <span class='assign token'>=</span> <span class='rubyid_year identifier id'>year</span> <span class='mod op'>%</span> <span class='integer val'>100</span>
|
677
|
+
<span class='rubyid_d identifier id'>d</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_b identifier id'>b</span> <span class='div op'>/</span> <span class='float val'>4.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_floor identifier id'>floor</span>
|
678
|
+
<span class='rubyid_e identifier id'>e</span> <span class='assign token'>=</span> <span class='rubyid_b identifier id'>b</span> <span class='mod op'>%</span> <span class='integer val'>4</span>
|
679
|
+
<span class='rubyid_f identifier id'>f</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='lparen token'>(</span><span class='rubyid_b identifier id'>b</span> <span class='plus op'>+</span> <span class='integer val'>8</span><span class='rparen token'>)</span> <span class='div op'>/</span> <span class='float val'>25.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_floor identifier id'>floor</span>
|
680
|
+
<span class='rubyid_g identifier id'>g</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='lparen token'>(</span><span class='rubyid_b identifier id'>b</span> <span class='minus op'>-</span> <span class='rubyid_f identifier id'>f</span> <span class='plus op'>+</span> <span class='integer val'>1</span><span class='rparen token'>)</span> <span class='div op'>/</span> <span class='float val'>3.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_floor identifier id'>floor</span>
|
681
|
+
<span class='rubyid_h identifier id'>h</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='lparen token'>(</span><span class='integer val'>19</span> <span class='mult op'>*</span> <span class='rubyid_a identifier id'>a</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='rubyid_b identifier id'>b</span> <span class='minus op'>-</span> <span class='rubyid_d identifier id'>d</span> <span class='minus op'>-</span> <span class='rubyid_g identifier id'>g</span> <span class='plus op'>+</span> <span class='integer val'>15</span><span class='rparen token'>)</span> <span class='mod op'>%</span> <span class='integer val'>30</span>
|
682
|
+
<span class='rubyid_i identifier id'>i</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='rubyid_c identifier id'>c</span> <span class='div op'>/</span> <span class='float val'>4.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_floor identifier id'>floor</span>
|
683
|
+
<span class='rubyid_k identifier id'>k</span> <span class='assign token'>=</span> <span class='rubyid_c identifier id'>c</span> <span class='mod op'>%</span> <span class='integer val'>4</span>
|
684
|
+
<span class='rubyid_l identifier id'>l</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='integer val'>32</span> <span class='plus op'>+</span> <span class='lparen token'>(</span><span class='integer val'>2</span> <span class='mult op'>*</span> <span class='rubyid_e identifier id'>e</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='lparen token'>(</span><span class='integer val'>2</span> <span class='mult op'>*</span> <span class='rubyid_i identifier id'>i</span><span class='rparen token'>)</span> <span class='minus op'>-</span> <span class='rubyid_h identifier id'>h</span> <span class='minus op'>-</span> <span class='rubyid_k identifier id'>k</span><span class='rparen token'>)</span> <span class='mod op'>%</span> <span class='integer val'>7</span>
|
685
|
+
<span class='rubyid_m identifier id'>m</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='lparen token'>(</span><span class='rubyid_a identifier id'>a</span> <span class='plus op'>+</span> <span class='lparen token'>(</span><span class='integer val'>11</span> <span class='mult op'>*</span> <span class='rubyid_h identifier id'>h</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='lparen token'>(</span><span class='integer val'>22</span> <span class='mult op'>*</span> <span class='rubyid_l identifier id'>l</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='div op'>/</span> <span class='float val'>451.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_floor identifier id'>floor</span>
|
686
|
+
|
687
|
+
<span class='rubyid_day identifier id'>day</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='lparen token'>(</span><span class='rubyid_h identifier id'>h</span> <span class='plus op'>+</span> <span class='rubyid_l identifier id'>l</span> <span class='minus op'>-</span> <span class='lparen token'>(</span><span class='integer val'>7</span> <span class='mult op'>*</span> <span class='rubyid_m identifier id'>m</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>114</span><span class='rparen token'>)</span> <span class='mod op'>%</span> <span class='integer val'>31</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>1</span>
|
688
|
+
<span class='rubyid_month identifier id'>month</span> <span class='assign token'>=</span> <span class='lparen token'>(</span><span class='lparen token'>(</span><span class='rubyid_h identifier id'>h</span> <span class='plus op'>+</span> <span class='rubyid_l identifier id'>l</span> <span class='minus op'>-</span> <span class='lparen token'>(</span><span class='integer val'>7</span> <span class='mult op'>*</span> <span class='rubyid_m identifier id'>m</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='integer val'>114</span><span class='rparen token'>)</span> <span class='div op'>/</span> <span class='float val'>31.0</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_floor identifier id'>floor</span>
|
689
|
+
<span class='colon3 op'>::</span><span class='rubyid_Date constant id'>Date</span><span class='dot token'>.</span><span class='rubyid_civil identifier id'>civil</span><span class='lparen token'>(</span><span class='rubyid_year identifier id'>year</span><span class='comma token'>,</span> <span class='rubyid_month identifier id'>month</span><span class='comma token'>,</span> <span class='rubyid_day identifier id'>day</span><span class='rparen token'>)</span>
|
690
|
+
<span class='rubyid_end end kw'>end</span>
|
691
|
+
</pre>
|
689
692
|
</td>
|
690
693
|
</tr>
|
691
694
|
</table>
|
@@ -778,9 +781,10 @@
|
|
778
781
|
<td>
|
779
782
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 84</span>
|
780
783
|
|
781
|
-
<span class='kw'>def</span> <span class='
|
782
|
-
<span class='op'>::</span><span class='
|
783
|
-
<span class='kw'>end</span
|
784
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_find_timezone identifier id'>find_timezone</span><span class='lparen token'>(</span><span class='rubyid_name identifier id'>name</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span><span class='comma token'>,</span> <span class='rubyid_dst_label identifier id'>dst_label</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
785
|
+
<span class='colon3 op'>::</span><span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_TimeZone constant id'>TimeZone</span><span class='dot token'>.</span><span class='rubyid_find identifier id'>find</span><span class='lparen token'>(</span><span class='rubyid_name identifier id'>name</span><span class='comma token'>,</span> <span class='rubyid_dst_label identifier id'>dst_label</span><span class='rparen token'>)</span>
|
786
|
+
<span class='rubyid_end end kw'>end</span>
|
787
|
+
</pre>
|
784
788
|
</td>
|
785
789
|
</tr>
|
786
790
|
</table>
|
@@ -888,19 +892,20 @@
|
|
888
892
|
<td>
|
889
893
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 162</span>
|
890
894
|
|
891
|
-
<span class='kw'>def</span> <span class='
|
892
|
-
<span class='
|
895
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_valid? fid id'>is_valid?</span><span class='lparen token'>(</span><span class='rubyid_value identifier id'>value</span><span class='comma token'>,</span> <span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span> <span class='string val'>"%F %T"</span><span class='rparen token'>)</span>
|
896
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span>
|
893
897
|
|
894
|
-
<span class='
|
898
|
+
<span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_custom_format identifier id'>custom_format</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
895
899
|
|
896
|
-
<span class='kw'>begin</span>
|
897
|
-
<span class='op'>::</span><span class='
|
898
|
-
<span class='kw'>rescue</span> <span class='op'
|
899
|
-
<span class='
|
900
|
-
<span class='kw'>end</span>
|
900
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
901
|
+
<span class='colon3 op'>::</span><span class='rubyid_DateTime constant id'>DateTime</span><span class='dot token'>.</span><span class='rubyid_strptime identifier id'>strptime</span><span class='lparen token'>(</span><span class='rubyid_value identifier id'>value</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='comma token'>,</span> <span class='rubyid_format identifier id'>format</span><span class='rparen token'>)</span>
|
902
|
+
<span class='rubyid_rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_e identifier id'>e</span>
|
903
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_false false kw'>false</span>
|
904
|
+
<span class='rubyid_end end kw'>end</span>
|
901
905
|
|
902
|
-
<span class='
|
903
|
-
<span class='kw'>end</span
|
906
|
+
<span class='rubyid_rv identifier id'>rv</span>
|
907
|
+
<span class='rubyid_end end kw'>end</span>
|
908
|
+
</pre>
|
904
909
|
</td>
|
905
910
|
</tr>
|
906
911
|
</table>
|
@@ -993,9 +998,10 @@
|
|
993
998
|
<td>
|
994
999
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 75</span>
|
995
1000
|
|
996
|
-
<span class='kw'>def</span> <span class='
|
997
|
-
<span class='op'>::</span><span class='
|
998
|
-
<span class='kw'>end</span
|
1001
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_list_timezones identifier id'>list_timezones</span><span class='lparen token'>(</span><span class='rubyid_with_dst identifier id'>with_dst</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span><span class='comma token'>,</span> <span class='rubyid_dst_label identifier id'>dst_label</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
1002
|
+
<span class='colon3 op'>::</span><span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_TimeZone constant id'>TimeZone</span><span class='dot token'>.</span><span class='rubyid_list_all identifier id'>list_all</span><span class='lparen token'>(</span><span class='rubyid_with_dst identifier id'>with_dst</span><span class='comma token'>,</span> <span class='rubyid_dst_label identifier id'>dst_label</span><span class='rparen token'>)</span>
|
1003
|
+
<span class='rubyid_end end kw'>end</span>
|
1004
|
+
</pre>
|
999
1005
|
</td>
|
1000
1006
|
</tr>
|
1001
1007
|
</table>
|
@@ -1081,12 +1087,13 @@
|
|
1081
1087
|
<td>
|
1082
1088
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 33</span>
|
1083
1089
|
|
1084
|
-
<span class='kw'>def</span> <span class='
|
1085
|
-
<span class='
|
1086
|
-
<span class='lparen'>(</span><span class='
|
1087
|
-
<span class='lbrace'>{</span><span class='symbol'>:value</span> <span class='op'
|
1088
|
-
<span class='rbrace'>}</span>
|
1089
|
-
<span class='kw'>end</span
|
1090
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_months identifier id'>months</span><span class='lparen token'>(</span><span class='rubyid_short identifier id'>short</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span>
|
1091
|
+
<span class='rubyid_months identifier id'>months</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_date_names identifier id'>date_names</span><span class='lbrack token'>[</span><span class='rubyid_short identifier id'>short</span> <span class='integer val'>? </span><span class='symbol val'>:short_months</span> <span class='colon op'>:</span> <span class='symbol val'>:long_months</span><span class='rbrack token'>]</span>
|
1092
|
+
<span class='lparen token'>(</span><span class='float val'>1</span><span class='dot2 op'>..</span><span class='integer val'>12</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_collect identifier id'>collect</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='rubyid_i identifier id'>i</span><span class='bitor op'>|</span>
|
1093
|
+
<span class='lbrace token'>{</span><span class='symbol val'>:value</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_i identifier id'>i</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='rubyid_rjust identifier id'>rjust</span><span class='lparen token'>(</span><span class='integer val'>2</span><span class='comma token'>,</span> <span class='string val'>"0"</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='symbol val'>:label=</span><span class='gt op'>></span> <span class='rubyid_months identifier id'>months</span><span class='dot token'>.</span><span class='rubyid_at identifier id'>at</span><span class='lparen token'>(</span><span class='rubyid_i identifier id'>i</span> <span class='minus op'>-</span> <span class='integer val'>1</span><span class='rparen token'>)</span><span class='rbrace token'>}</span>
|
1094
|
+
<span class='rbrace token'>}</span>
|
1095
|
+
<span class='rubyid_end end kw'>end</span>
|
1096
|
+
</pre>
|
1090
1097
|
</td>
|
1091
1098
|
</tr>
|
1092
1099
|
</table>
|
@@ -1105,9 +1112,9 @@
|
|
1105
1112
|
<div class="discussion">
|
1106
1113
|
<p>Returns a string representation of a timezone.</p>
|
1107
1114
|
|
1108
|
-
<pre class="code ruby"><code><span class='
|
1109
|
-
<span class='comment'># => "-0800@pacific-time-us-canada"
|
1110
|
-
</
|
1115
|
+
<pre class="code ruby"><code><span class='rubyid_DateTime constant id'>DateTime</span><span class='dot token'>.</span><span class='rubyid_parameterize_zone identifier id'>parameterize_zone</span><span class='lparen token'>(</span><span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_TimeZone constant id'>TimeZone</span><span class='lbrack token'>[</span><span class='string val'>"Pacific Time (US & Canada)"</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
|
1116
|
+
<span class='comment val'># => "-0800@pacific-time-us-canada"</span>
|
1117
|
+
</code></pre>
|
1111
1118
|
|
1112
1119
|
|
1113
1120
|
</div>
|
@@ -1181,9 +1188,10 @@
|
|
1181
1188
|
<td>
|
1182
1189
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 97</span>
|
1183
1190
|
|
1184
|
-
<span class='kw'>def</span> <span class='
|
1185
|
-
<span class='op'>::</span><span class='
|
1186
|
-
<span class='kw'>end</span
|
1191
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_parameterize_zone identifier id'>parameterize_zone</span><span class='lparen token'>(</span><span class='rubyid_tz identifier id'>tz</span><span class='comma token'>,</span> <span class='rubyid_with_offset identifier id'>with_offset</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span>
|
1192
|
+
<span class='colon3 op'>::</span><span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_TimeZone constant id'>TimeZone</span><span class='colon2 op'>::</span><span class='rubyid_parameterize_zone identifier id'>parameterize_zone</span><span class='lparen token'>(</span><span class='rubyid_tz identifier id'>tz</span><span class='comma token'>,</span> <span class='rubyid_with_offset identifier id'>with_offset</span><span class='rparen token'>)</span>
|
1193
|
+
<span class='rubyid_end end kw'>end</span>
|
1194
|
+
</pre>
|
1187
1195
|
</td>
|
1188
1196
|
</tr>
|
1189
1197
|
</table>
|
@@ -1257,9 +1265,10 @@
|
|
1257
1265
|
<td>
|
1258
1266
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 116</span>
|
1259
1267
|
|
1260
|
-
<span class='kw'>def</span> <span class='
|
1261
|
-
<span class='op'>::</span><span class='
|
1262
|
-
<span class='kw'>end</span
|
1268
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_rationalize_offset identifier id'>rationalize_offset</span><span class='lparen token'>(</span><span class='rubyid_offset identifier id'>offset</span><span class='rparen token'>)</span>
|
1269
|
+
<span class='colon3 op'>::</span><span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_TimeZone constant id'>TimeZone</span><span class='dot token'>.</span><span class='rubyid_rationalize_offset identifier id'>rationalize_offset</span><span class='lparen token'>(</span><span class='rubyid_offset identifier id'>offset</span><span class='rparen token'>)</span>
|
1270
|
+
<span class='rubyid_end end kw'>end</span>
|
1271
|
+
</pre>
|
1263
1272
|
</td>
|
1264
1273
|
</tr>
|
1265
1274
|
</table>
|
@@ -1314,9 +1323,10 @@
|
|
1314
1323
|
<td>
|
1315
1324
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 66</span>
|
1316
1325
|
|
1317
|
-
<span class='kw'>def</span> <span class='
|
1318
|
-
<span class='op'>::</span><span class='
|
1319
|
-
<span class='kw'>end</span
|
1326
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_timezones identifier id'>timezones</span>
|
1327
|
+
<span class='colon3 op'>::</span><span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_TimeZone constant id'>TimeZone</span><span class='dot token'>.</span><span class='rubyid_all identifier id'>all</span>
|
1328
|
+
<span class='rubyid_end end kw'>end</span>
|
1329
|
+
</pre>
|
1320
1330
|
</td>
|
1321
1331
|
</tr>
|
1322
1332
|
</table>
|
@@ -1431,9 +1441,10 @@
|
|
1431
1441
|
<td>
|
1432
1442
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 108</span>
|
1433
1443
|
|
1434
|
-
<span class='kw'>def</span> <span class='
|
1435
|
-
<span class='op'>::</span><span class='
|
1436
|
-
<span class='kw'>end</span
|
1444
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_unparameterize_zone identifier id'>unparameterize_zone</span><span class='lparen token'>(</span><span class='rubyid_tz identifier id'>tz</span><span class='comma token'>,</span> <span class='rubyid_as_string identifier id'>as_string</span> <span class='assign token'>=</span> <span class='rubyid_false false kw'>false</span><span class='comma token'>,</span> <span class='rubyid_dst_label identifier id'>dst_label</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
1445
|
+
<span class='colon3 op'>::</span><span class='rubyid_ActiveSupport constant id'>ActiveSupport</span><span class='colon2 op'>::</span><span class='rubyid_TimeZone constant id'>TimeZone</span><span class='colon2 op'>::</span><span class='rubyid_unparameterize_zone identifier id'>unparameterize_zone</span><span class='lparen token'>(</span><span class='rubyid_tz identifier id'>tz</span><span class='comma token'>,</span> <span class='rubyid_as_string identifier id'>as_string</span><span class='comma token'>,</span> <span class='rubyid_dst_label identifier id'>dst_label</span><span class='rparen token'>)</span>
|
1446
|
+
<span class='rubyid_end end kw'>end</span>
|
1447
|
+
</pre>
|
1437
1448
|
</td>
|
1438
1449
|
</tr>
|
1439
1450
|
</table>
|
@@ -1452,13 +1463,13 @@
|
|
1452
1463
|
<div class="discussion">
|
1453
1464
|
<p>Returns a range of years.</p>
|
1454
1465
|
|
1455
|
-
<pre class="code ruby"><code><span class='
|
1456
|
-
<span class='comment'># => [2007, 2008, 2009, 2010]
|
1457
|
-
</
|
1466
|
+
<pre class="code ruby"><code><span class='rubyid_Date constant id'>Date</span><span class='dot token'>.</span><span class='rubyid_years identifier id'>years</span><span class='lparen token'>(</span><span class='integer val'>3</span><span class='comma token'>,</span> <span class='rubyid_false false kw'>false</span><span class='comma token'>,</span> <span class='integer val'>2010</span><span class='rparen token'>)</span>
|
1467
|
+
<span class='comment val'># => [2007, 2008, 2009, 2010]</span>
|
1468
|
+
</code></pre>
|
1458
1469
|
|
1459
|
-
<pre class="code ruby"><code><span class='
|
1460
|
-
<span class='comment'># => [{:value=>2009, :label=>2009}, {:value=>2010, :label=>2010}, {:value=>2011, :label=>2011}]
|
1461
|
-
</
|
1470
|
+
<pre class="code ruby"><code><span class='rubyid_Date constant id'>Date</span><span class='dot token'>.</span><span class='rubyid_years identifier id'>years</span><span class='lparen token'>(</span><span class='integer val'>1</span><span class='comma token'>,</span> <span class='rubyid_true true kw'>true</span><span class='comma token'>,</span> <span class='integer val'>2010</span><span class='comma token'>,</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span>
|
1471
|
+
<span class='comment val'># => [{:value=>2009, :label=>2009}, {:value=>2010, :label=>2010}, {:value=>2011, :label=>2011}]</span>
|
1472
|
+
</code></pre>
|
1462
1473
|
|
1463
1474
|
|
1464
1475
|
</div>
|
@@ -1569,10 +1580,11 @@
|
|
1569
1580
|
<td>
|
1570
1581
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 58</span>
|
1571
1582
|
|
1572
|
-
<span class='kw'>def</span> <span class='
|
1573
|
-
<span class='
|
1574
|
-
<span class='lparen'>(</span><span class='
|
1575
|
-
<span class='kw'>end</span
|
1583
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_years identifier id'>years</span><span class='lparen token'>(</span><span class='rubyid_offset identifier id'>offset</span> <span class='assign token'>=</span> <span class='integer val'>10</span><span class='comma token'>,</span> <span class='rubyid_also_future identifier id'>also_future</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span><span class='comma token'>,</span> <span class='rubyid_reference identifier id'>reference</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='rubyid_as_objects identifier id'>as_objects</span> <span class='assign token'>=</span> <span class='rubyid_false false kw'>false</span><span class='rparen token'>)</span>
|
1584
|
+
<span class='rubyid_y identifier id'>y</span> <span class='assign token'>=</span> <span class='rubyid_reference identifier id'>reference</span> <span class='orop op'>||</span> <span class='colon3 op'>::</span><span class='rubyid_Date constant id'>Date</span><span class='dot token'>.</span><span class='rubyid_today identifier id'>today</span><span class='dot token'>.</span><span class='rubyid_year identifier id'>year</span>
|
1585
|
+
<span class='lparen token'>(</span><span class='rubyid_y identifier id'>y</span> <span class='minus op'>-</span> <span class='rubyid_offset identifier id'>offset</span><span class='dot2 op'>..</span><span class='lparen token'>(</span><span class='rubyid_also_future identifier id'>also_future</span> <span class='integer val'>? </span><span class='rubyid_y identifier id'>y</span> <span class='plus op'>+</span> <span class='rubyid_offset identifier id'>offset</span> <span class='colon op'>:</span> <span class='rubyid_y identifier id'>y</span><span class='rparen token'>)</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_collect identifier id'>collect</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='rubyid_year identifier id'>year</span><span class='bitor op'>|</span> <span class='rubyid_as_objects identifier id'>as_objects</span> <span class='integer val'>? </span><span class='lbrace token'>{</span><span class='symbol val'>:value</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_year identifier id'>year</span><span class='comma token'>,</span> <span class='symbol val'>:label</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_year identifier id'>year</span><span class='rbrace token'>}</span> <span class='colon op'>:</span> <span class='rubyid_year identifier id'>year</span> <span class='rbrace token'>}</span>
|
1586
|
+
<span class='rubyid_end end kw'>end</span>
|
1587
|
+
</pre>
|
1576
1588
|
</td>
|
1577
1589
|
</tr>
|
1578
1590
|
</table>
|
@@ -1583,9 +1595,9 @@
|
|
1583
1595
|
</div>
|
1584
1596
|
|
1585
1597
|
<div id="footer">
|
1586
|
-
Generated on
|
1598
|
+
Generated on Sat Jul 28 11:24:55 2012 by
|
1587
1599
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1588
|
-
0.8.2.1 (ruby-1.
|
1600
|
+
0.8.2.1 (ruby-1.8.7).
|
1589
1601
|
</div>
|
1590
1602
|
|
1591
1603
|
</body>
|
@@ -116,9 +116,9 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Sat Jul 28 11:24:55 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.8.7).
|
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
|
127
|
+
Generated on Sat Jul 28 11:24:56 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.8.7).
|
130
130
|
</div>
|
131
131
|
|
132
132
|
</body>
|
@@ -278,19 +278,20 @@
|
|
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='kw'>def</span> <span class='
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
<span class='kw'>end</span
|
281
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='rubyid_args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
|
282
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span>
|
283
|
+
|
284
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_has_key? fid id'>has_key?</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rparen token'>)</span> <span class='rubyid_then then kw'>then</span>
|
285
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='lbrack token'>[</span><span class='rubyid_method identifier id'>method</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rbrack token'>]</span>
|
286
|
+
<span class='rubyid_elsif elsif kw'>elsif</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_has_key? fid id'>has_key?</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span><span class='rparen token'>)</span> <span class='rubyid_then then kw'>then</span>
|
287
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='lbrack token'>[</span><span class='rubyid_method identifier id'>method</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span><span class='rbrack token'>]</span>
|
288
|
+
<span class='rubyid_else else kw'>else</span>
|
289
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_Hash constant id'>Hash</span><span class='dot token'>.</span><span class='rubyid_method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='rubyid_args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
|
290
|
+
<span class='rubyid_end end kw'>end</span>
|
291
|
+
|
292
|
+
<span class='rubyid_rv identifier id'>rv</span>
|
293
|
+
<span class='rubyid_end end kw'>end</span>
|
294
|
+
</pre>
|
294
295
|
</td>
|
295
296
|
</tr>
|
296
297
|
</table>
|
@@ -371,9 +372,10 @@
|
|
371
372
|
<td>
|
372
373
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/hash.rb', line 37</span>
|
373
374
|
|
374
|
-
<span class='kw'>def</span> <span class='
|
375
|
-
|
376
|
-
<span class='kw'>end</span
|
375
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_respond_to? fid id'>respond_to?</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='rparen token'>)</span>
|
376
|
+
<span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_has_key? fid id'>has_key?</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_has_key? fid id'>has_key?</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_true true kw'>true</span> <span class='colon op'>:</span> <span class='colon3 op'>::</span><span class='rubyid_Hash constant id'>Hash</span><span class='dot token'>.</span><span class='rubyid_respond_to? fid id'>respond_to?</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='rparen token'>)</span>
|
377
|
+
<span class='rubyid_end end kw'>end</span>
|
378
|
+
</pre>
|
377
379
|
</td>
|
378
380
|
</tr>
|
379
381
|
</table>
|
@@ -384,9 +386,9 @@
|
|
384
386
|
</div>
|
385
387
|
|
386
388
|
<div id="footer">
|
387
|
-
Generated on
|
389
|
+
Generated on Sat Jul 28 11:24:53 2012 by
|
388
390
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
389
|
-
0.8.2.1 (ruby-1.
|
391
|
+
0.8.2.1 (ruby-1.8.7).
|
390
392
|
</div>
|
391
393
|
|
392
394
|
</body>
|
@@ -121,9 +121,9 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Sat Jul 28 11:24:53 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.8.7).
|
127
127
|
</div>
|
128
128
|
|
129
129
|
</body>
|
@@ -240,17 +240,18 @@
|
|
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='kw'>def</span> <span class='
|
244
|
-
<span class='
|
245
|
-
|
246
|
-
<span class='
|
247
|
-
<span class='kw'>if</span> <span class='
|
248
|
-
<span class='
|
249
|
-
<span class='
|
250
|
-
<span class='kw'>end</span>
|
251
|
-
|
252
|
-
<span class='
|
253
|
-
<span class='kw'>end</span
|
243
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_max identifier id'>max</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='rubyid_args identifier id'>args</span><span class='rparen token'>)</span>
|
244
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span>
|
245
|
+
|
246
|
+
<span class='rubyid_args identifier id'>args</span> <span class='assign token'>=</span> <span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_ensure_array identifier id'>ensure_array</span><span class='dot token'>.</span><span class='rubyid_flatten identifier id'>flatten</span>
|
247
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_length identifier id'>length</span> <span class='gt op'>></span> <span class='integer val'>0</span> <span class='rubyid_then then kw'>then</span>
|
248
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_args identifier id'>args</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span>
|
249
|
+
<span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_a identifier id'>a</span><span class='bitor op'>|</span> <span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_a identifier id'>a</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_a identifier id'>a</span> <span class='gt op'>></span> <span class='rubyid_rv identifier id'>rv</span> <span class='rubyid_end end kw'>end</span>
|
250
|
+
<span class='rubyid_end end kw'>end</span>
|
251
|
+
|
252
|
+
<span class='rubyid_rv identifier id'>rv</span>
|
253
|
+
<span class='rubyid_end end kw'>end</span>
|
254
|
+
</pre>
|
254
255
|
</td>
|
255
256
|
</tr>
|
256
257
|
</table>
|
@@ -332,17 +333,18 @@
|
|
332
333
|
<td>
|
333
334
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/math.rb', line 19</span>
|
334
335
|
|
335
|
-
<span class='kw'>def</span> <span class='
|
336
|
-
<span class='
|
336
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_min identifier id'>min</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='rubyid_args identifier id'>args</span><span class='rparen token'>)</span>
|
337
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span>
|
337
338
|
|
338
|
-
<span class='
|
339
|
-
<span class='kw'>if</span> <span class='
|
340
|
-
<span class='
|
341
|
-
<span class='
|
342
|
-
<span class='kw'>end</span>
|
339
|
+
<span class='rubyid_args identifier id'>args</span> <span class='assign token'>=</span> <span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_ensure_array identifier id'>ensure_array</span><span class='dot token'>.</span><span class='rubyid_flatten identifier id'>flatten</span>
|
340
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_length identifier id'>length</span> <span class='gt op'>></span> <span class='integer val'>0</span> <span class='rubyid_then then kw'>then</span>
|
341
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_args identifier id'>args</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span>
|
342
|
+
<span class='rubyid_args identifier id'>args</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_a identifier id'>a</span><span class='bitor op'>|</span> <span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_a identifier id'>a</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_a identifier id'>a</span> <span class='lt op'><</span> <span class='rubyid_rv identifier id'>rv</span> <span class='rubyid_end end kw'>end</span>
|
343
|
+
<span class='rubyid_end end kw'>end</span>
|
343
344
|
|
344
|
-
<span class='
|
345
|
-
<span class='kw'>end</span
|
345
|
+
<span class='rubyid_rv identifier id'>rv</span>
|
346
|
+
<span class='rubyid_end end kw'>end</span>
|
347
|
+
</pre>
|
346
348
|
</td>
|
347
349
|
</tr>
|
348
350
|
</table>
|
@@ -353,9 +355,9 @@
|
|
353
355
|
</div>
|
354
356
|
|
355
357
|
<div id="footer">
|
356
|
-
Generated on
|
358
|
+
Generated on Sat Jul 28 11:24:53 2012 by
|
357
359
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
358
|
-
0.8.2.1 (ruby-1.
|
360
|
+
0.8.2.1 (ruby-1.8.7).
|
359
361
|
</div>
|
360
362
|
|
361
363
|
</body>
|
@@ -549,21 +549,22 @@
|
|
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='kw'>def</span> <span class='
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
<span class='kw'>end</span
|
552
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_debug_dump identifier id'>debug_dump</span><span class='lparen token'>(</span><span class='rubyid_format identifier id'>format</span> <span class='assign token'>=</span> <span class='symbol val'>:yaml</span><span class='comma token'>,</span> <span class='rubyid_must_raise identifier id'>must_raise</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span>
|
553
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='string val'>""</span>
|
554
|
+
|
555
|
+
<span class='rubyid_begin begin kw'>begin</span>
|
556
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_format identifier id'>format</span> <span class='eq op'>==</span> <span class='symbol val'>:pretty_json</span> <span class='rubyid_then then kw'>then</span>
|
557
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_JSON constant id'>JSON</span><span class='dot token'>.</span><span class='rubyid_pretty_generate identifier id'>pretty_generate</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='rparen token'>)</span>
|
558
|
+
<span class='rubyid_else else kw'>else</span>
|
559
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_send identifier id'>send</span><span class='lparen token'>(</span><span class='dstring node'>"to_#{format}"</span><span class='rparen token'>)</span>
|
560
|
+
<span class='rubyid_end end kw'>end</span>
|
561
|
+
<span class='rubyid_rescue rescue kw'>rescue</span>
|
562
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_inspect identifier id'>inspect</span>
|
563
|
+
<span class='rubyid_end end kw'>end</span>
|
564
|
+
|
565
|
+
<span class='rubyid_must_raise identifier id'>must_raise</span> <span class='integer val'>? </span><span class='rubyid_raise identifier id'>raise</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='colon2 op'>::</span><span class='rubyid_Exceptions constant id'>Exceptions</span><span class='colon2 op'>::</span><span class='rubyid_Dump constant id'>Dump</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_rv identifier id'>rv</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_rv identifier id'>rv</span>
|
566
|
+
<span class='rubyid_end end kw'>end</span>
|
567
|
+
</pre>
|
567
568
|
</td>
|
568
569
|
</tr>
|
569
570
|
</table>
|
@@ -618,9 +619,10 @@
|
|
618
619
|
<td>
|
619
620
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 55</span>
|
620
621
|
|
621
|
-
<span class='kw'>def</span> <span class='
|
622
|
-
|
623
|
-
<span class='kw'>end</span
|
622
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_ensure_array identifier id'>ensure_array</span>
|
623
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Array constant id'>Array</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_self self kw'>self</span> <span class='colon op'>:</span> <span class='lbrack token'>[</span><span class='rubyid_self self kw'>self</span><span class='rbrack token'>]</span>
|
624
|
+
<span class='rubyid_end end kw'>end</span>
|
625
|
+
</pre>
|
624
626
|
</td>
|
625
627
|
</tr>
|
626
628
|
</table>
|
@@ -675,9 +677,10 @@
|
|
675
677
|
<td>
|
676
678
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 62</span>
|
677
679
|
|
678
|
-
<span class='kw'>def</span> <span class='
|
679
|
-
|
680
|
-
<span class='kw'>end</span
|
680
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_ensure_string identifier id'>ensure_string</span>
|
681
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_present? fid id'>present?</span> <span class='integer val'>? </span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_to_s identifier id'>to_s</span> <span class='colon op'>:</span> <span class='string val'>""</span>
|
682
|
+
<span class='rubyid_end end kw'>end</span>
|
683
|
+
</pre>
|
681
684
|
</td>
|
682
685
|
</tr>
|
683
686
|
</table>
|
@@ -782,14 +785,15 @@
|
|
782
785
|
<td>
|
783
786
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 134</span>
|
784
787
|
|
785
|
-
<span class='kw'>def</span> <span class='
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
788
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_format_boolean identifier id'>format_boolean</span><span class='lparen token'>(</span><span class='rubyid_true_name identifier id'>true_name</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='rubyid_false_name identifier id'>false_name</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
789
|
+
<span class='rubyid_names identifier id'>names</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span>
|
790
|
+
<span class='rubyid_true true kw'>true</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_true_name identifier id'>true_name</span> <span class='orop op'>||</span> <span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_boolean_names identifier id'>boolean_names</span><span class='lbrack token'>[</span><span class='rubyid_true true kw'>true</span><span class='rbrack token'>]</span><span class='comma token'>,</span>
|
791
|
+
<span class='rubyid_false false kw'>false</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_false_name identifier id'>false_name</span> <span class='orop op'>||</span> <span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_boolean_names identifier id'>boolean_names</span><span class='lbrack token'>[</span><span class='rubyid_false false kw'>false</span><span class='rbrack token'>]</span>
|
792
|
+
<span class='rbrace token'>}</span>
|
790
793
|
|
791
|
-
|
792
|
-
<span class='kw'>end</span
|
794
|
+
<span class='rubyid_names identifier id'>names</span><span class='lbrack token'>[</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_to_boolean identifier id'>to_boolean</span><span class='rbrack token'>]</span>
|
795
|
+
<span class='rubyid_end end kw'>end</span>
|
796
|
+
</pre>
|
793
797
|
</td>
|
794
798
|
</tr>
|
795
799
|
</table>
|
@@ -928,14 +932,15 @@
|
|
928
932
|
<td>
|
929
933
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 119</span>
|
930
934
|
|
931
|
-
<span class='kw'>def</span> <span class='
|
932
|
-
<span class='
|
933
|
-
<span class='
|
934
|
-
<span class='
|
935
|
-
<span class='
|
935
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_format_number identifier id'>format_number</span><span class='lparen token'>(</span><span class='rubyid_prec identifier id'>prec</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='rubyid_decimal_separator identifier id'>decimal_separator</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='rubyid_add_string identifier id'>add_string</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='comma token'>,</span> <span class='rubyid_k_separator identifier id'>k_separator</span> <span class='assign token'>=</span> <span class='rubyid_nil nil kw'>nil</span><span class='rparen token'>)</span>
|
936
|
+
<span class='rubyid_prec identifier id'>prec</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_format_number identifier id'>format_number</span><span class='lbrack token'>[</span><span class='symbol val'>:prec</span><span class='rbrack token'>]</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_prec identifier id'>prec</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span>
|
937
|
+
<span class='rubyid_decimal_separator identifier id'>decimal_separator</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_format_number identifier id'>format_number</span><span class='lbrack token'>[</span><span class='symbol val'>:decimal_separator</span><span class='rbrack token'>]</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_decimal_separator identifier id'>decimal_separator</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span>
|
938
|
+
<span class='rubyid_add_string identifier id'>add_string</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_format_number identifier id'>format_number</span><span class='lbrack token'>[</span><span class='symbol val'>:add_string</span><span class='rbrack token'>]</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_add_string identifier id'>add_string</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span>
|
939
|
+
<span class='rubyid_k_separator identifier id'>k_separator</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_Cowtech constant id'>Cowtech</span><span class='colon2 op'>::</span><span class='rubyid_Extensions constant id'>Extensions</span><span class='dot token'>.</span><span class='rubyid_settings identifier id'>settings</span><span class='dot token'>.</span><span class='rubyid_format_number identifier id'>format_number</span><span class='lbrack token'>[</span><span class='symbol val'>:k_separator</span><span class='rbrack token'>]</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_k_separator identifier id'>k_separator</span><span class='dot token'>.</span><span class='rubyid_nil? fid id'>nil?</span>
|
936
940
|
|
937
|
-
<span class='lparen'>(</span><span class='kw'>self</span><span class='
|
938
|
-
<span class='kw'>end</span
|
941
|
+
<span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_number? fid id'>is_number?</span> <span class='andop op'>&&</span> <span class='rubyid_prec identifier id'>prec</span> <span class='geq op'>>=</span> <span class='integer val'>0</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_number_to_currency identifier id'>number_to_currency</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='comma token'>,</span> <span class='lbrace token'>{</span><span class='symbol val'>:precision</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_prec identifier id'>prec</span><span class='comma token'>,</span> <span class='symbol val'>:separator</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_decimal_separator identifier id'>decimal_separator</span><span class='comma token'>,</span> <span class='symbol val'>:delimiter</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_k_separator identifier id'>k_separator</span><span class='comma token'>,</span> <span class='symbol val'>:format</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_add_string identifier id'>add_string</span><span class='dot token'>.</span><span class='rubyid_blank? fid id'>blank?</span> <span class='integer val'>? </span><span class='string val'>"%n"</span> <span class='colon op'>:</span> <span class='string val'>"%n %u"</span><span class='comma token'>,</span> <span class='symbol val'>:unit</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_add_string identifier id'>add_string</span><span class='dot token'>.</span><span class='rubyid_blank? fid id'>blank?</span> <span class='integer val'>? </span><span class='string val'>""</span> <span class='colon op'>:</span> <span class='rubyid_add_string identifier id'>add_string</span><span class='dot token'>.</span><span class='rubyid_strip identifier id'>strip</span><span class='rbrace token'>}</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
942
|
+
<span class='rubyid_end end kw'>end</span>
|
943
|
+
</pre>
|
939
944
|
</td>
|
940
945
|
</tr>
|
941
946
|
</table>
|
@@ -990,9 +995,10 @@
|
|
990
995
|
<td>
|
991
996
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 48</span>
|
992
997
|
|
993
|
-
<span class='kw'>def</span> <span class='
|
994
|
-
|
995
|
-
<span class='kw'>end</span
|
998
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_boolean? fid id'>is_boolean?</span>
|
999
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_TrueClass constant id'>TrueClass</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_FalseClass constant id'>FalseClass</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_NilClass constant id'>NilClass</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_strip identifier id'>strip</span> <span class='match op'>=~</span> <span class='regexp val'>/^(1|0|true|false|yes|no|t|f|y|n)$/i</span><span class='rparen token'>)</span>
|
1000
|
+
<span class='rubyid_end end kw'>end</span>
|
1001
|
+
</pre>
|
996
1002
|
</td>
|
997
1003
|
</tr>
|
998
1004
|
</table>
|
@@ -1047,9 +1053,10 @@
|
|
1047
1053
|
<td>
|
1048
1054
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 41</span>
|
1049
1055
|
|
1050
|
-
<span class='kw'>def</span> <span class='
|
1051
|
-
|
1052
|
-
<span class='kw'>end</span
|
1056
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_float? fid id'>is_float?</span>
|
1057
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Float constant id'>Float</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='regexp val'>/^([+-]?)(\d+)([.,]\d+)?$/</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_normalize_number identifier id'>normalize_number</span><span class='rparen token'>)</span>
|
1058
|
+
<span class='rubyid_end end kw'>end</span>
|
1059
|
+
</pre>
|
1053
1060
|
</td>
|
1054
1061
|
</tr>
|
1055
1062
|
</table>
|
@@ -1104,9 +1111,10 @@
|
|
1104
1111
|
<td>
|
1105
1112
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 34</span>
|
1106
1113
|
|
1107
|
-
<span class='kw'>def</span> <span class='
|
1108
|
-
|
1109
|
-
<span class='kw'>end</span
|
1114
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_integer? fid id'>is_integer?</span>
|
1115
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Integer constant id'>Integer</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='regexp val'>/^([+-]?)(\d+)$/</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_normalize_number identifier id'>normalize_number</span><span class='rparen token'>)</span>
|
1116
|
+
<span class='rubyid_end end kw'>end</span>
|
1117
|
+
</pre>
|
1110
1118
|
</td>
|
1111
1119
|
</tr>
|
1112
1120
|
</table>
|
@@ -1161,9 +1169,10 @@
|
|
1161
1169
|
<td>
|
1162
1170
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 27</span>
|
1163
1171
|
|
1164
|
-
<span class='kw'>def</span> <span class='
|
1165
|
-
|
1166
|
-
<span class='kw'>end</span
|
1172
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_is_number? fid id'>is_number?</span>
|
1173
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_float? fid id'>is_float?</span>
|
1174
|
+
<span class='rubyid_end end kw'>end</span>
|
1175
|
+
</pre>
|
1167
1176
|
</td>
|
1168
1177
|
</tr>
|
1169
1178
|
</table>
|
@@ -1221,12 +1230,13 @@
|
|
1221
1230
|
<td>
|
1222
1231
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 17</span>
|
1223
1232
|
|
1224
|
-
<span class='kw'>def</span> <span class='
|
1225
|
-
<span class='
|
1226
|
-
<span class='
|
1227
|
-
<span class='
|
1228
|
-
<span class='
|
1229
|
-
<span class='kw'>end</span
|
1233
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_normalize_number identifier id'>normalize_number</span>
|
1234
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_strip identifier id'>strip</span>
|
1235
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_rv identifier id'>rv</span><span class='dot token'>.</span><span class='rubyid_split identifier id'>split</span><span class='lparen token'>(</span><span class='regexp val'>/[\.,]/</span><span class='rparen token'>)</span>
|
1236
|
+
<span class='rubyid_rv identifier id'>rv</span><span class='lbrack token'>[</span><span class='integer val'>-1</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='string val'>"."</span> <span class='plus op'>+</span> <span class='rubyid_rv identifier id'>rv</span><span class='lbrack token'>[</span><span class='integer val'>-1</span><span class='rbrack token'>]</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_rv identifier id'>rv</span><span class='dot token'>.</span><span class='rubyid_length identifier id'>length</span> <span class='gt op'>></span> <span class='integer val'>1</span>
|
1237
|
+
<span class='rubyid_rv identifier id'>rv</span><span class='dot token'>.</span><span class='rubyid_join identifier id'>join</span><span class='lparen token'>(</span><span class='string val'>""</span><span class='rparen token'>)</span>
|
1238
|
+
<span class='rubyid_end end kw'>end</span>
|
1239
|
+
</pre>
|
1230
1240
|
</td>
|
1231
1241
|
</tr>
|
1232
1242
|
</table>
|
@@ -1302,9 +1312,10 @@
|
|
1302
1312
|
<td>
|
1303
1313
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 107</span>
|
1304
1314
|
|
1305
|
-
<span class='kw'>def</span> <span class='
|
1306
|
-
|
1307
|
-
<span class='kw'>end</span
|
1315
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_round_to_precision identifier id'>round_to_precision</span><span class='lparen token'>(</span><span class='rubyid_prec identifier id'>prec</span> <span class='assign token'>=</span> <span class='integer val'>2</span><span class='rparen token'>)</span>
|
1316
|
+
<span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_number? fid id'>is_number?</span> <span class='andop op'>&&</span> <span class='rubyid_prec identifier id'>prec</span> <span class='geq op'>>=</span> <span class='integer val'>0</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_number_with_precision identifier id'>number_with_precision</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='comma token'>,</span> <span class='symbol val'>:precision</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_prec identifier id'>prec</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_nil nil kw'>nil</span>
|
1317
|
+
<span class='rubyid_end end kw'>end</span>
|
1318
|
+
</pre>
|
1308
1319
|
</td>
|
1309
1320
|
</tr>
|
1310
1321
|
</table>
|
@@ -1361,11 +1372,12 @@
|
|
1361
1372
|
<td>
|
1362
1373
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 97</span>
|
1363
1374
|
|
1364
|
-
<span class='kw'>def</span> <span class='
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
<span class='kw'>end</span
|
1375
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_to_boolean identifier id'>to_boolean</span>
|
1376
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span>
|
1377
|
+
<span class='rubyid_rv identifier id'>rv</span> <span class='assign token'>=</span> <span class='rubyid_rv identifier id'>rv</span><span class='dot token'>.</span><span class='rubyid_to_i identifier id'>to_i</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_rv identifier id'>rv</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Float constant id'>Float</span><span class='rparen token'>)</span>
|
1378
|
+
<span class='lparen token'>(</span><span class='rubyid_rv identifier id'>rv</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='rubyid_TrueClass constant id'>TrueClass</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='regexp val'>/^(1|on|true|yes|t|y)$/i</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='rubyid_rv identifier id'>rv</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_strip identifier id'>strip</span><span class='rparen token'>)</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_true true kw'>true</span> <span class='colon op'>:</span> <span class='rubyid_false false kw'>false</span>
|
1379
|
+
<span class='rubyid_end end kw'>end</span>
|
1380
|
+
</pre>
|
1369
1381
|
</td>
|
1370
1382
|
</tr>
|
1371
1383
|
</table>
|
@@ -1447,15 +1459,16 @@
|
|
1447
1459
|
<td>
|
1448
1460
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 70</span>
|
1449
1461
|
|
1450
|
-
<span class='kw'>def</span> <span class='
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
<span class='kw'>end</span
|
1462
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_to_float identifier id'>to_float</span><span class='lparen token'>(</span><span class='rubyid_default_value identifier id'>default_value</span> <span class='assign token'>=</span> <span class='integer val'>0</span><span class='integer val'>.0</span><span class='rparen token'>)</span>
|
1463
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Float constant id'>Float</span><span class='rparen token'>)</span>
|
1464
|
+
<span class='rubyid_self self kw'>self</span>
|
1465
|
+
<span class='rubyid_elsif elsif kw'>elsif</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Integer constant id'>Integer</span><span class='rparen token'>)</span>
|
1466
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_to_f identifier id'>to_f</span>
|
1467
|
+
<span class='rubyid_else else kw'>else</span>
|
1468
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_float? fid id'>is_float?</span> <span class='integer val'>? </span><span class='colon2 op'>::</span><span class='rubyid_Kernel constant id'>Kernel</span><span class='dot token'>.</span><span class='rubyid_Float constant id'>Float</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_normalize_number identifier id'>normalize_number</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_default_value identifier id'>default_value</span>
|
1469
|
+
<span class='rubyid_end end kw'>end</span>
|
1470
|
+
<span class='rubyid_end end kw'>end</span>
|
1471
|
+
</pre>
|
1459
1472
|
</td>
|
1460
1473
|
</tr>
|
1461
1474
|
</table>
|
@@ -1537,15 +1550,16 @@
|
|
1537
1550
|
<td>
|
1538
1551
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/object.rb', line 84</span>
|
1539
1552
|
|
1540
|
-
<span class='kw'>def</span> <span class='
|
1541
|
-
<span class='kw'>if</span> <span class='kw'>self</span><span class='
|
1542
|
-
<span class='kw'>self</span>
|
1543
|
-
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='
|
1544
|
-
<span class='kw'>self</span><span class='
|
1545
|
-
<span class='kw'>else</span>
|
1546
|
-
<span class='kw'>self</span><span class='
|
1547
|
-
<span class='kw'>end</span>
|
1548
|
-
<span class='kw'>end</span
|
1553
|
+
<span class='rubyid_def def kw'>def</span> <span class='rubyid_to_integer identifier id'>to_integer</span><span class='lparen token'>(</span><span class='rubyid_default_value identifier id'>default_value</span> <span class='assign token'>=</span> <span class='integer val'>0</span><span class='rparen token'>)</span>
|
1554
|
+
<span class='rubyid_if if kw'>if</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Integer constant id'>Integer</span><span class='rparen token'>)</span>
|
1555
|
+
<span class='rubyid_self self kw'>self</span>
|
1556
|
+
<span class='rubyid_elsif elsif kw'>elsif</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='colon3 op'>::</span><span class='rubyid_Float constant id'>Float</span><span class='rparen token'>)</span>
|
1557
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_to_i identifier id'>to_i</span>
|
1558
|
+
<span class='rubyid_else else kw'>else</span>
|
1559
|
+
<span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_is_integer? fid id'>is_integer?</span> <span class='integer val'>? </span><span class='colon2 op'>::</span><span class='rubyid_Kernel constant id'>Kernel</span><span class='dot token'>.</span><span class='rubyid_Integer constant id'>Integer</span><span class='lparen token'>(</span><span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_normalize_number identifier id'>normalize_number</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='rubyid_default_value identifier id'>default_value</span>
|
1560
|
+
<span class='rubyid_end end kw'>end</span>
|
1561
|
+
<span class='rubyid_end end kw'>end</span>
|
1562
|
+
</pre>
|
1549
1563
|
</td>
|
1550
1564
|
</tr>
|
1551
1565
|
</table>
|
@@ -1556,9 +1570,9 @@
|
|
1556
1570
|
</div>
|
1557
1571
|
|
1558
1572
|
<div id="footer">
|
1559
|
-
Generated on
|
1573
|
+
Generated on Sat Jul 28 11:24:54 2012 by
|
1560
1574
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1561
|
-
0.8.2.1 (ruby-1.
|
1575
|
+
0.8.2.1 (ruby-1.8.7).
|
1562
1576
|
</div>
|
1563
1577
|
|
1564
1578
|
</body>
|