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
@@ -431,13 +431,12 @@
|
|
431
431
|
<td>
|
432
432
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 31</span>
|
433
433
|
|
434
|
-
<span class='
|
435
|
-
<span class='
|
436
|
-
<span class='
|
437
|
-
<span class='
|
438
|
-
<span class='
|
439
|
-
<span class='
|
440
|
-
</pre>
|
434
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
435
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
|
436
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
|
437
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
|
438
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
439
|
+
<span class='kw'>end</span></pre>
|
441
440
|
</td>
|
442
441
|
</tr>
|
443
442
|
</table>
|
@@ -482,10 +481,9 @@
|
|
482
481
|
<td>
|
483
482
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 15</span>
|
484
483
|
|
485
|
-
<span class='
|
486
|
-
<span class='
|
487
|
-
<span class='
|
488
|
-
</pre>
|
484
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_boolean_names'>boolean_names</span>
|
485
|
+
<span class='ivar'>@boolean_names</span>
|
486
|
+
<span class='kw'>end</span></pre>
|
489
487
|
</td>
|
490
488
|
</tr>
|
491
489
|
</table>
|
@@ -525,10 +523,9 @@
|
|
525
523
|
<td>
|
526
524
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 21</span>
|
527
525
|
|
528
|
-
<span class='
|
529
|
-
<span class='
|
530
|
-
<span class='
|
531
|
-
</pre>
|
526
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_date_formats'>date_formats</span>
|
527
|
+
<span class='ivar'>@date_formats</span>
|
528
|
+
<span class='kw'>end</span></pre>
|
532
529
|
</td>
|
533
530
|
</tr>
|
534
531
|
</table>
|
@@ -568,10 +565,9 @@
|
|
568
565
|
<td>
|
569
566
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 18</span>
|
570
567
|
|
571
|
-
<span class='
|
572
|
-
<span class='
|
573
|
-
<span class='
|
574
|
-
</pre>
|
568
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_date_names'>date_names</span>
|
569
|
+
<span class='ivar'>@date_names</span>
|
570
|
+
<span class='kw'>end</span></pre>
|
575
571
|
</td>
|
576
572
|
</tr>
|
577
573
|
</table>
|
@@ -611,10 +607,9 @@
|
|
611
607
|
<td>
|
612
608
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 12</span>
|
613
609
|
|
614
|
-
<span class='
|
615
|
-
<span class='
|
616
|
-
<span class='
|
617
|
-
</pre>
|
610
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_format_number'>format_number</span>
|
611
|
+
<span class='ivar'>@format_number</span>
|
612
|
+
<span class='kw'>end</span></pre>
|
618
613
|
</td>
|
619
614
|
</tr>
|
620
615
|
</table>
|
@@ -676,10 +671,9 @@
|
|
676
671
|
<td>
|
677
672
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 26</span>
|
678
673
|
|
679
|
-
<span class='
|
680
|
-
<span class='
|
681
|
-
<span class='
|
682
|
-
</pre>
|
674
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
675
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
676
|
+
<span class='kw'>end</span></pre>
|
683
677
|
</td>
|
684
678
|
</tr>
|
685
679
|
</table>
|
@@ -787,12 +781,11 @@
|
|
787
781
|
<td>
|
788
782
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 61</span>
|
789
783
|
|
790
|
-
<span class='
|
791
|
-
<span class='
|
792
|
-
<span class='
|
793
|
-
<span class='
|
794
|
-
<span class='
|
795
|
-
</pre>
|
784
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</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>
|
785
|
+
<span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Yes</span><span class='tstring_end'>"</span></span>
|
786
|
+
<span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>No</span><span class='tstring_end'>"</span></span>
|
787
|
+
<span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=></span> <span class='id identifier rubyid_true_name'>true_name</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
|
788
|
+
<span class='kw'>end</span></pre>
|
796
789
|
</td>
|
797
790
|
</tr>
|
798
791
|
</table>
|
@@ -910,28 +903,27 @@
|
|
910
903
|
<td>
|
911
904
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 73</span>
|
912
905
|
|
913
|
-
<span class='
|
914
|
-
<span class='
|
915
|
-
<span class='symbol
|
916
|
-
<span class='symbol
|
917
|
-
<span class='symbol
|
918
|
-
<span class='symbol
|
919
|
-
<span class='rbrace
|
920
|
-
|
921
|
-
<span class='
|
922
|
-
<span class='
|
923
|
-
<span class='
|
924
|
-
<span class='
|
925
|
-
<span class='
|
926
|
-
<span class='
|
927
|
-
<span class='
|
928
|
-
|
929
|
-
<span class='
|
930
|
-
<span class='
|
931
|
-
|
932
|
-
<span class='
|
933
|
-
<span class='
|
934
|
-
</pre>
|
906
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
907
|
+
<span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
908
|
+
<span class='symbol'>:ct_date</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%Y-%m-%d</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
909
|
+
<span class='symbol'>:ct_time</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
910
|
+
<span class='symbol'>:ct_date_time</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%F %T</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
911
|
+
<span class='symbol'>:ct_iso_8601</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%FT%T%z</span><span class='tstring_end'>"</span></span>
|
912
|
+
<span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
913
|
+
|
914
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</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'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
915
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
|
916
|
+
<span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
917
|
+
<span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span><span class='rparen'>)</span>
|
918
|
+
<span class='kw'>else</span>
|
919
|
+
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
|
920
|
+
<span class='kw'>end</span>
|
921
|
+
|
922
|
+
<span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
|
923
|
+
<span class='kw'>end</span>
|
924
|
+
|
925
|
+
<span class='ivar'>@date_formats</span>
|
926
|
+
<span class='kw'>end</span></pre>
|
935
927
|
</td>
|
936
928
|
</tr>
|
937
929
|
</table>
|
@@ -1079,20 +1071,19 @@
|
|
1079
1071
|
<td>
|
1080
1072
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 105</span>
|
1081
1073
|
|
1082
|
-
<span class='
|
1083
|
-
<span class='
|
1084
|
-
<span class='
|
1085
|
-
<span class='
|
1086
|
-
<span class='
|
1087
|
-
|
1088
|
-
<span class='
|
1089
|
-
<span class='symbol
|
1090
|
-
<span class='symbol
|
1091
|
-
<span class='symbol
|
1092
|
-
<span class='symbol
|
1093
|
-
<span class='rbrace
|
1094
|
-
<span class='
|
1095
|
-
</pre>
|
1074
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1075
|
+
<span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>January</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>February</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>March</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>April</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>May</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>June</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>July</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>August</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>September</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>October</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>November</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>December</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
1076
|
+
<span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Jan</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Feb</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Mar</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Apr</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>May</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Jun</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Jul</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Aug</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Sep</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Oct</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Nov</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Dec</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
1077
|
+
<span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Sunday</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Monday</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Tuesday</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Wednesday</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Thursday</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Friday</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Saturday</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
1078
|
+
<span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Sun</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Mon</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Tue</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Wed</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Thu</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Fri</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Sat</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
1079
|
+
|
1080
|
+
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1081
|
+
<span class='symbol'>:long_months</span> <span class='op'>=></span> <span class='id identifier rubyid_long_months'>long_months</span><span class='comma'>,</span>
|
1082
|
+
<span class='symbol'>:short_months</span> <span class='op'>=></span> <span class='id identifier rubyid_short_months'>short_months</span><span class='comma'>,</span>
|
1083
|
+
<span class='symbol'>:long_days</span> <span class='op'>=></span> <span class='id identifier rubyid_long_days'>long_days</span><span class='comma'>,</span>
|
1084
|
+
<span class='symbol'>:short_days</span> <span class='op'>=></span> <span class='id identifier rubyid_short_days'>short_days</span>
|
1085
|
+
<span class='rbrace'>}</span>
|
1086
|
+
<span class='kw'>end</span></pre>
|
1096
1087
|
</td>
|
1097
1088
|
</tr>
|
1098
1089
|
</table>
|
@@ -1231,15 +1222,14 @@
|
|
1231
1222
|
<td>
|
1232
1223
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/settings.rb', line 46</span>
|
1233
1224
|
|
1234
|
-
<span class='
|
1235
|
-
<span class='
|
1236
|
-
<span class='symbol
|
1237
|
-
<span class='symbol
|
1238
|
-
<span class='symbol
|
1239
|
-
<span class='symbol
|
1240
|
-
<span class='rbrace
|
1241
|
-
<span class='
|
1242
|
-
</pre>
|
1225
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</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='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</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='rparen'>)</span>
|
1226
|
+
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1227
|
+
<span class='symbol'>:prec</span> <span class='op'>=></span> <span class='id identifier rubyid_prec'>prec</span><span class='comma'>,</span>
|
1228
|
+
<span class='symbol'>:decimal_separator</span> <span class='op'>=></span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span>
|
1229
|
+
<span class='symbol'>:add_string</span> <span class='op'>=></span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span>
|
1230
|
+
<span class='symbol'>:k_separator</span> <span class='op'>=></span> <span class='id identifier rubyid_k_separator'>k_separator</span>
|
1231
|
+
<span class='rbrace'>}</span>
|
1232
|
+
<span class='kw'>end</span></pre>
|
1243
1233
|
</td>
|
1244
1234
|
</tr>
|
1245
1235
|
</table>
|
@@ -1250,9 +1240,9 @@
|
|
1250
1240
|
</div>
|
1251
1241
|
|
1252
1242
|
<div id="footer">
|
1253
|
-
Generated on Fri Jul 20
|
1243
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
1254
1244
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1255
|
-
0.8.2.1 (ruby-1.
|
1245
|
+
0.8.2.1 (ruby-1.9.2).
|
1256
1246
|
</div>
|
1257
1247
|
|
1258
1248
|
</body>
|
@@ -228,9 +228,9 @@
|
|
228
228
|
<div class="discussion">
|
229
229
|
<p>Removes accents from the string, normalizing to the normal letter.</p>
|
230
230
|
|
231
|
-
<pre class="code ruby"><code><span class='
|
232
|
-
<span class='comment
|
233
|
-
</code></pre>
|
231
|
+
<pre class="code ruby"><code><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>èòàù</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_remove_accents'>remove_accents</span>
|
232
|
+
<span class='comment'># => "eoau"
|
233
|
+
</span></code></pre>
|
234
234
|
|
235
235
|
|
236
236
|
</div>
|
@@ -270,12 +270,11 @@
|
|
270
270
|
<td>
|
271
271
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/string.rb', line 21</span>
|
272
272
|
|
273
|
-
<span class='
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
<span class='
|
278
|
-
</pre>
|
273
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_remove_accents'>remove_accents</span>
|
274
|
+
<span class='id identifier rubyid_silence_warnings'>silence_warnings</span> <span class='lbrace'>{</span>
|
275
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_mb_chars'>mb_chars</span><span class='period'>.</span><span class='id identifier rubyid_normalize'>normalize</span><span class='lparen'>(</span><span class='symbol'>:kd</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[^\x00-\x7F]</span><span class='regexp_end'>/n</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
276
|
+
<span class='rbrace'>}</span>
|
277
|
+
<span class='kw'>end</span></pre>
|
279
278
|
</td>
|
280
279
|
</tr>
|
281
280
|
</table>
|
@@ -330,10 +329,9 @@
|
|
330
329
|
<td>
|
331
330
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/string.rb', line 44</span>
|
332
331
|
|
333
|
-
<span class='
|
334
|
-
|
335
|
-
<span class='
|
336
|
-
</pre>
|
332
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_replace_ampersands'>replace_ampersands</span>
|
333
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>&amp;(\S+);</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>&\\1;</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
334
|
+
<span class='kw'>end</span></pre>
|
337
335
|
</td>
|
338
336
|
</tr>
|
339
337
|
</table>
|
@@ -354,9 +352,9 @@
|
|
354
352
|
|
355
353
|
<p>The string is downcased and spaces are substituted with <code>-</code>.</p>
|
356
354
|
|
357
|
-
<pre class="code ruby"><code><span class='
|
358
|
-
<span class='comment
|
359
|
-
</code></pre>
|
355
|
+
<pre class="code ruby"><code><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ABC cde</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_untitleize'>untitleize</span>
|
356
|
+
<span class='comment'># => "abc-cde"
|
357
|
+
</span></code></pre>
|
360
358
|
|
361
359
|
|
362
360
|
</div>
|
@@ -394,10 +392,9 @@
|
|
394
392
|
<td>
|
395
393
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/string.rb', line 37</span>
|
396
394
|
|
397
|
-
<span class='
|
398
|
-
|
399
|
-
<span class='
|
400
|
-
</pre>
|
395
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_untitleize'>untitleize</span>
|
396
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
397
|
+
<span class='kw'>end</span></pre>
|
401
398
|
</td>
|
402
399
|
</tr>
|
403
400
|
</table>
|
@@ -452,10 +449,9 @@
|
|
452
449
|
<td>
|
453
450
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/string.rb', line 51</span>
|
454
451
|
|
455
|
-
<span class='
|
456
|
-
|
457
|
-
<span class='
|
458
|
-
</pre>
|
452
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
|
453
|
+
<span class='kw'>self</span>
|
454
|
+
<span class='kw'>end</span></pre>
|
459
455
|
</td>
|
460
456
|
</tr>
|
461
457
|
</table>
|
@@ -466,9 +462,9 @@
|
|
466
462
|
</div>
|
467
463
|
|
468
464
|
<div id="footer">
|
469
|
-
Generated on Fri Jul 20
|
465
|
+
Generated on Fri Jul 20 14:28:06 2012 by
|
470
466
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
471
|
-
0.8.2.1 (ruby-1.
|
467
|
+
0.8.2.1 (ruby-1.9.2).
|
472
468
|
</div>
|
473
469
|
|
474
470
|
</body>
|
@@ -166,6 +166,29 @@
|
|
166
166
|
<span class="summary_desc"><div class='inline'><p>Return the correction applied to the standard offset the timezone when the DST (Daylight Saving Time) is active.</p>
|
167
167
|
</div></span>
|
168
168
|
|
169
|
+
</li>
|
170
|
+
|
171
|
+
|
172
|
+
<li class="public ">
|
173
|
+
<span class="summary_signature">
|
174
|
+
|
175
|
+
<a href="#dst_name-instance_method" title="#dst_name (instance method)">- (String) <strong>dst_name</strong>(dst_label = nil, year = nil) </a>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</span>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<span class="summary_desc"><div class='inline'><p>Returns the name for this zone with DST (Daylight Saving Time) active.</p>
|
190
|
+
</div></span>
|
191
|
+
|
169
192
|
</li>
|
170
193
|
|
171
194
|
|
@@ -255,7 +278,7 @@
|
|
255
278
|
|
256
279
|
|
257
280
|
|
258
|
-
<span class="summary_desc"><div class='inline'><p>Returns
|
281
|
+
<span class="summary_desc"><div class='inline'><p>Returns a parametized string representation for this zone.</p>
|
259
282
|
</div></span>
|
260
283
|
|
261
284
|
</li>
|
@@ -278,7 +301,7 @@
|
|
278
301
|
|
279
302
|
|
280
303
|
|
281
|
-
<span class="summary_desc"><div class='inline'><p>Returns
|
304
|
+
<span class="summary_desc"><div class='inline'><p>Returns a string representation for this zone with DST (Daylight Saving Time) active.</p>
|
282
305
|
</div></span>
|
283
306
|
|
284
307
|
</li>
|
@@ -301,7 +324,7 @@
|
|
301
324
|
|
302
325
|
|
303
326
|
|
304
|
-
<span class="summary_desc"><div class='inline'><p>Returns
|
327
|
+
<span class="summary_desc"><div class='inline'><p>Returns a parametized string representation for this zone with DST (Daylight Saving Time) active.</p>
|
305
328
|
</div></span>
|
306
329
|
|
307
330
|
</li>
|
@@ -432,15 +455,14 @@
|
|
432
455
|
<td>
|
433
456
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 373</span>
|
434
457
|
|
435
|
-
<span class='
|
436
|
-
<span class='
|
458
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_current_offset'>current_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rational'>rational</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_date'>date</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
459
|
+
<span class='id identifier rubyid_date'>date</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
437
460
|
|
438
|
-
<span class='
|
461
|
+
<span class='id identifier rubyid_dst_period'>dst_period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span>
|
439
462
|
|
440
|
-
<span class='
|
441
|
-
<span class='
|
442
|
-
<span class='
|
443
|
-
</pre>
|
463
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_period_for_utc'>period_for_utc</span><span class='lparen'>(</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_dst?'>dst?</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_offset'>dst_offset</span> <span class='op'>:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_offset'>offset</span><span class='rparen'>)</span>
|
464
|
+
<span class='id identifier rubyid_rational'>rational</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
465
|
+
<span class='kw'>end</span></pre>
|
444
466
|
</td>
|
445
467
|
</tr>
|
446
468
|
</table>
|
@@ -535,12 +557,110 @@
|
|
535
557
|
<td>
|
536
558
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 419</span>
|
537
559
|
|
538
|
-
<span class='
|
539
|
-
<span class='
|
540
|
-
<span class='
|
541
|
-
<span class='
|
542
|
-
<span class='
|
543
|
-
</
|
560
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dst_correction'>dst_correction</span><span class='lparen'>(</span><span class='id identifier rubyid_rational'>rational</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
561
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span>
|
562
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_period'>period</span> <span class='op'>?</span> <span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_std_offset'>std_offset</span> <span class='op'>:</span> <span class='int'>0</span>
|
563
|
+
<span class='id identifier rubyid_rational'>rational</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
564
|
+
<span class='kw'>end</span></pre>
|
565
|
+
</td>
|
566
|
+
</tr>
|
567
|
+
</table>
|
568
|
+
</div>
|
569
|
+
|
570
|
+
<div class="method_details ">
|
571
|
+
<h3 class="signature " id="dst_name-instance_method">
|
572
|
+
|
573
|
+
- (<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>) <strong>dst_name</strong>(dst_label = nil, year = nil)
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
</h3><div class="docstring">
|
580
|
+
<div class="discussion">
|
581
|
+
<p>Returns the name for this zone with DST (Daylight Saving Time) active.</p>
|
582
|
+
|
583
|
+
|
584
|
+
</div>
|
585
|
+
</div>
|
586
|
+
<div class="tags">
|
587
|
+
<p class="tag_title">Parameters:</p>
|
588
|
+
<ul class="param">
|
589
|
+
|
590
|
+
<li>
|
591
|
+
|
592
|
+
<span class='name'>dst_label</span>
|
593
|
+
|
594
|
+
|
595
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
|
596
|
+
|
597
|
+
|
598
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
599
|
+
|
600
|
+
|
601
|
+
—
|
602
|
+
<div class='inline'><p>Label for the DST indication. Defaults to <code>(Daylight Saving Time)</code>.</p>
|
603
|
+
</div>
|
604
|
+
|
605
|
+
</li>
|
606
|
+
|
607
|
+
<li>
|
608
|
+
|
609
|
+
<span class='name'>year</span>
|
610
|
+
|
611
|
+
|
612
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
613
|
+
|
614
|
+
|
615
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
616
|
+
|
617
|
+
|
618
|
+
—
|
619
|
+
<div class='inline'><p>The year to which refer to. Defaults to the current year.</p>
|
620
|
+
</div>
|
621
|
+
|
622
|
+
</li>
|
623
|
+
|
624
|
+
</ul>
|
625
|
+
|
626
|
+
<p class="tag_title">Returns:</p>
|
627
|
+
<ul class="return">
|
628
|
+
|
629
|
+
<li>
|
630
|
+
|
631
|
+
|
632
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Cowtech::Extensions::String (module)">String</a></span></tt>)</span>
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
—
|
637
|
+
<div class='inline'><p>The name for the zone with DST or <code>nil</code>, if the timezone doesn't use DST for that year.</p>
|
638
|
+
</div>
|
639
|
+
|
640
|
+
</li>
|
641
|
+
|
642
|
+
</ul>
|
643
|
+
|
644
|
+
</div><table class="source_code">
|
645
|
+
<tr>
|
646
|
+
<td>
|
647
|
+
<pre class="lines">
|
648
|
+
|
649
|
+
|
650
|
+
441
|
651
|
+
442
|
652
|
+
443
|
653
|
+
444
|
654
|
+
445</pre>
|
655
|
+
</td>
|
656
|
+
<td>
|
657
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 441</span>
|
658
|
+
|
659
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dst_name'>dst_name</span><span class='lparen'>(</span><span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
660
|
+
<span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(Daylight Saving Time)</span><span class='tstring_end'>"</span></span>
|
661
|
+
|
662
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_uses_dst?'>uses_dst?</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dst_label'>dst_label</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='kw'>nil</span>
|
663
|
+
<span class='kw'>end</span></pre>
|
544
664
|
</td>
|
545
665
|
</tr>
|
546
666
|
</table>
|
@@ -635,12 +755,11 @@
|
|
635
755
|
<td>
|
636
756
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 430</span>
|
637
757
|
|
638
|
-
<span class='
|
639
|
-
<span class='
|
640
|
-
<span class='
|
641
|
-
<span class='
|
642
|
-
<span class='
|
643
|
-
</pre>
|
758
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dst_offset'>dst_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rational'>rational</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
759
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span>
|
760
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_period'>period</span> <span class='op'>?</span> <span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_utc_total_offset'>utc_total_offset</span> <span class='op'>:</span> <span class='int'>0</span>
|
761
|
+
<span class='id identifier rubyid_rational'>rational</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
762
|
+
<span class='kw'>end</span></pre>
|
644
763
|
</td>
|
645
764
|
</tr>
|
646
765
|
</table>
|
@@ -723,17 +842,16 @@
|
|
723
842
|
<td>
|
724
843
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 395</span>
|
725
844
|
|
726
|
-
<span class='
|
727
|
-
<span class='
|
728
|
-
|
729
|
-
<span class='rubyid_nothern_summer identifier id'>nothern_summer</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_DateTime constant id'>DateTime</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='integer val'>7</span><span class='comma token'>,</span> <span class='integer val'>15</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_utc identifier id'>utc</span> <span class='comment val'># This is a representation of a summer period in the Northern Hemisphere.</span>
|
730
|
-
<span class='rubyid_southern_summer identifier id'>southern_summer</span> <span class='assign token'>=</span> <span class='colon3 op'>::</span><span class='rubyid_DateTime constant id'>DateTime</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='integer val'>1</span><span class='comma token'>,</span> <span class='integer val'>15</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_utc identifier id'>utc</span> <span class='comment val'># This is a representation of a summer period in the Northern Hemisphere.</span>
|
845
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
846
|
+
<span class='id identifier rubyid_year'>year</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_today'>today</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span>
|
731
847
|
|
732
|
-
<span class='
|
733
|
-
<span class='
|
734
|
-
|
735
|
-
<span class='
|
736
|
-
</
|
848
|
+
<span class='id identifier rubyid_nothern_summer'>nothern_summer</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_civil'>civil</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='int'>7</span><span class='comma'>,</span> <span class='int'>15</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span> <span class='comment'># This is a representation of a summer period in the Northern Hemisphere.
|
849
|
+
</span> <span class='id identifier rubyid_southern_summer'>southern_summer</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_civil'>civil</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='int'>1</span><span class='comma'>,</span> <span class='int'>15</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span> <span class='comment'># This is a representation of a summer period in the Northern Hemisphere.
|
850
|
+
</span>
|
851
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_period_for_utc'>period_for_utc</span><span class='lparen'>(</span><span class='id identifier rubyid_nothern_summer'>nothern_summer</span><span class='rparen'>)</span>
|
852
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_period_for_utc'>period_for_utc</span><span class='lparen'>(</span><span class='id identifier rubyid_southern_summer'>southern_summer</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_dst?'>dst?</span>
|
853
|
+
<span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_dst?'>dst?</span> <span class='op'>?</span> <span class='id identifier rubyid_period'>period</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
854
|
+
<span class='kw'>end</span></pre>
|
737
855
|
</td>
|
738
856
|
</tr>
|
739
857
|
</table>
|
@@ -810,11 +928,10 @@
|
|
810
928
|
<td>
|
811
929
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 386</span>
|
812
930
|
|
813
|
-
<span class='
|
814
|
-
<span class='
|
815
|
-
<span class='
|
816
|
-
<span class='
|
817
|
-
</pre>
|
931
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_offset'>offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rational'>rational</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
932
|
+
<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_utc_offset'>utc_offset</span>
|
933
|
+
<span class='id identifier rubyid_rational'>rational</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
934
|
+
<span class='kw'>end</span></pre>
|
818
935
|
</td>
|
819
936
|
</tr>
|
820
937
|
</table>
|
@@ -831,7 +948,7 @@
|
|
831
948
|
|
832
949
|
</h3><div class="docstring">
|
833
950
|
<div class="discussion">
|
834
|
-
<p>Returns
|
951
|
+
<p>Returns a parametized string representation for this zone.</p>
|
835
952
|
|
836
953
|
|
837
954
|
</div>
|
@@ -870,7 +987,7 @@
|
|
870
987
|
|
871
988
|
|
872
989
|
—
|
873
|
-
<div class='inline'><p>The parametized
|
990
|
+
<div class='inline'><p>The parametized string representation for this zone.</p>
|
874
991
|
</div>
|
875
992
|
|
876
993
|
</li>
|
@@ -883,17 +1000,16 @@
|
|
883
1000
|
<pre class="lines">
|
884
1001
|
|
885
1002
|
|
886
|
-
|
887
|
-
|
888
|
-
|
1003
|
+
468
|
1004
|
+
469
|
1005
|
+
470</pre>
|
889
1006
|
</td>
|
890
1007
|
<td>
|
891
|
-
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line
|
1008
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 468</span>
|
892
1009
|
|
893
|
-
<span class='
|
894
|
-
<span class='
|
895
|
-
<span class='
|
896
|
-
</pre>
|
1010
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s_parameterized'>to_s_parameterized</span><span class='lparen'>(</span><span class='id identifier rubyid_with_offset'>with_offset</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1011
|
+
<span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='period'>.</span><span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span><span class='rparen'>)</span>
|
1012
|
+
<span class='kw'>end</span></pre>
|
897
1013
|
</td>
|
898
1014
|
</tr>
|
899
1015
|
</table>
|
@@ -910,7 +1026,7 @@
|
|
910
1026
|
|
911
1027
|
</h3><div class="docstring">
|
912
1028
|
<div class="discussion">
|
913
|
-
<p>Returns
|
1029
|
+
<p>Returns a string representation for this zone with DST (Daylight Saving Time) active.</p>
|
914
1030
|
|
915
1031
|
|
916
1032
|
</div>
|
@@ -966,7 +1082,7 @@
|
|
966
1082
|
|
967
1083
|
|
968
1084
|
—
|
969
|
-
<div class='inline'><p>The
|
1085
|
+
<div class='inline'><p>The string representation for the zone with DST or <code>nil</code>, if the timezone doesn't use DST for that year.</p>
|
970
1086
|
</div>
|
971
1087
|
|
972
1088
|
</li>
|
@@ -979,33 +1095,32 @@
|
|
979
1095
|
<pre class="lines">
|
980
1096
|
|
981
1097
|
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
1098
|
+
452
|
1099
|
+
453
|
1100
|
+
454
|
1101
|
+
455
|
1102
|
+
456
|
1103
|
+
457
|
1104
|
+
458
|
1105
|
+
459
|
1106
|
+
460
|
1107
|
+
461
|
1108
|
+
462</pre>
|
993
1109
|
</td>
|
994
1110
|
<td>
|
995
|
-
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line
|
996
|
-
|
997
|
-
<span class='
|
998
|
-
<span class='
|
999
|
-
|
1000
|
-
<span class='
|
1001
|
-
<span class='
|
1002
|
-
<span class='
|
1003
|
-
<span class='
|
1004
|
-
<span class='
|
1005
|
-
<span class='
|
1006
|
-
<span class='
|
1007
|
-
<span class='
|
1008
|
-
</pre>
|
1111
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 452</span>
|
1112
|
+
|
1113
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s_with_dst'>to_s_with_dst</span><span class='lparen'>(</span><span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1114
|
+
<span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(Daylight Saving Time)</span><span class='tstring_end'>"</span></span>
|
1115
|
+
|
1116
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_uses_dst?'>uses_dst?</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
1117
|
+
<span class='id identifier rubyid_period'>period</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span>
|
1118
|
+
<span class='id identifier rubyid_offset'>offset</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_seconds_to_utc_offset'>seconds_to_utc_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_period'>period</span><span class='period'>.</span><span class='id identifier rubyid_utc_total_offset'>utc_total_offset</span><span class='rparen'>)</span>
|
1119
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>(GMT</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_offset'>offset</span><span class='rbrace'>}</span><span class='tstring_content'>) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dst_label'>dst_label</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
1120
|
+
<span class='kw'>else</span>
|
1121
|
+
<span class='kw'>nil</span>
|
1122
|
+
<span class='kw'>end</span>
|
1123
|
+
<span class='kw'>end</span></pre>
|
1009
1124
|
</td>
|
1010
1125
|
</tr>
|
1011
1126
|
</table>
|
@@ -1022,7 +1137,7 @@
|
|
1022
1137
|
|
1023
1138
|
</h3><div class="docstring">
|
1024
1139
|
<div class="discussion">
|
1025
|
-
<p>Returns
|
1140
|
+
<p>Returns a parametized string representation for this zone with DST (Daylight Saving Time) active.</p>
|
1026
1141
|
|
1027
1142
|
|
1028
1143
|
</div>
|
@@ -1095,7 +1210,7 @@
|
|
1095
1210
|
|
1096
1211
|
|
1097
1212
|
—
|
1098
|
-
<div class='inline'><p>The parametized
|
1213
|
+
<div class='inline'><p>The parametized string representation for this zone with DST or <code>nil</code>, if the timezone doesn't use DST for that year.</p>
|
1099
1214
|
</div>
|
1100
1215
|
|
1101
1216
|
</li>
|
@@ -1108,19 +1223,18 @@
|
|
1108
1223
|
<pre class="lines">
|
1109
1224
|
|
1110
1225
|
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1226
|
+
478
|
1227
|
+
479
|
1228
|
+
480
|
1229
|
+
481</pre>
|
1115
1230
|
</td>
|
1116
1231
|
<td>
|
1117
|
-
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line
|
1232
|
+
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 478</span>
|
1118
1233
|
|
1119
|
-
<span class='
|
1120
|
-
<span class='
|
1121
|
-
<span class='
|
1122
|
-
<span class='
|
1123
|
-
</pre>
|
1234
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s_with_dst_parameterized'>to_s_with_dst_parameterized</span><span class='lparen'>(</span><span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1235
|
+
<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_to_s_with_dst'>to_s_with_dst</span><span class='lparen'>(</span><span class='id identifier rubyid_dst_label'>dst_label</span><span class='comma'>,</span> <span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span>
|
1236
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='period'>.</span><span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1237
|
+
<span class='kw'>end</span></pre>
|
1124
1238
|
</td>
|
1125
1239
|
</tr>
|
1126
1240
|
</table>
|
@@ -1196,10 +1310,9 @@
|
|
1196
1310
|
<td>
|
1197
1311
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 410</span>
|
1198
1312
|
|
1199
|
-
<span class='
|
1200
|
-
<span class='
|
1201
|
-
<span class='
|
1202
|
-
</pre>
|
1313
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_uses_dst?'>uses_dst?</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1314
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dst_period'>dst_period</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
1315
|
+
<span class='kw'>end</span></pre>
|
1203
1316
|
</td>
|
1204
1317
|
</tr>
|
1205
1318
|
</table>
|
@@ -1210,9 +1323,9 @@
|
|
1210
1323
|
</div>
|
1211
1324
|
|
1212
1325
|
<div id="footer">
|
1213
|
-
Generated on Fri Jul 20
|
1326
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
1214
1327
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1215
|
-
0.8.2.1 (ruby-1.
|
1328
|
+
0.8.2.1 (ruby-1.9.2).
|
1216
1329
|
</div>
|
1217
1330
|
|
1218
1331
|
</body>
|