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
data/doc/Cowtech.html
CHANGED
@@ -119,9 +119,9 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
|
|
119
119
|
</div>
|
120
120
|
|
121
121
|
<div id="footer">
|
122
|
-
Generated on Fri Jul 20
|
122
|
+
Generated on Fri Jul 20 14:28:06 2012 by
|
123
123
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
124
|
-
0.8.2.1 (ruby-1.
|
124
|
+
0.8.2.1 (ruby-1.9.2).
|
125
125
|
</div>
|
126
126
|
|
127
127
|
</body>
|
data/doc/Cowtech/Extensions.html
CHANGED
@@ -250,10 +250,9 @@
|
|
250
250
|
<td>
|
251
251
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions.rb', line 31</span>
|
252
252
|
|
253
|
-
<span class='
|
254
|
-
<span class='
|
255
|
-
<span class='
|
256
|
-
</pre>
|
253
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_ruby_18?'>is_ruby_18?</span>
|
254
|
+
<span class='const'>RUBY_VERSION</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^1\.8</span><span class='regexp_end'>/</span></span>
|
255
|
+
<span class='kw'>end</span></pre>
|
257
256
|
</td>
|
258
257
|
</tr>
|
259
258
|
</table>
|
@@ -406,82 +405,81 @@
|
|
406
405
|
<td>
|
407
406
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions.rb', line 53</span>
|
408
407
|
|
409
|
-
<span class='
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
<span class='
|
484
|
-
</pre>
|
408
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load!'>load!</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_what'>what</span><span class='rparen'>)</span>
|
409
|
+
<span class='id identifier rubyid_what'>what</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>object</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>boolean</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>string</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>hash</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>datetime</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>math</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pathname</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>==</span> <span class='int'>0</span>
|
410
|
+
<span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_collect!'>collect!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_w'>w</span><span class='op'>|</span> <span class='id identifier rubyid_w'>w</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='rbrace'>}</span>
|
411
|
+
|
412
|
+
<span class='comment'># Dependency resolving
|
413
|
+
</span> <span class='id identifier rubyid_what'>what</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>object</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>datetime</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
414
|
+
<span class='id identifier rubyid_what'>what</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>object</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>math</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
415
|
+
<span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_uniq!'>uniq!</span>
|
416
|
+
|
417
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>object</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>then</span>
|
418
|
+
<span class='op'>::</span><span class='const'>Object</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
419
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Object</span>
|
420
|
+
<span class='kw'>end</span>
|
421
|
+
<span class='kw'>end</span>
|
422
|
+
|
423
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>boolean</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>then</span>
|
424
|
+
<span class='op'>::</span><span class='const'>TrueClass</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
425
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Object</span>
|
426
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Boolean</span>
|
427
|
+
<span class='kw'>end</span>
|
428
|
+
|
429
|
+
<span class='op'>::</span><span class='const'>FalseClass</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
430
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Object</span>
|
431
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Boolean</span>
|
432
|
+
<span class='kw'>end</span>
|
433
|
+
<span class='kw'>end</span>
|
434
|
+
|
435
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>string</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>then</span>
|
436
|
+
<span class='op'>::</span><span class='const'>String</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
437
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>String</span>
|
438
|
+
<span class='kw'>end</span>
|
439
|
+
<span class='kw'>end</span>
|
440
|
+
|
441
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>hash</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>then</span>
|
442
|
+
<span class='op'>::</span><span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
443
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Hash</span>
|
444
|
+
<span class='kw'>end</span>
|
445
|
+
<span class='kw'>end</span>
|
446
|
+
|
447
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>datetime</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>then</span>
|
448
|
+
<span class='op'>::</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
449
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>DateTime</span>
|
450
|
+
<span class='kw'>end</span>
|
451
|
+
|
452
|
+
<span class='op'>::</span><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
453
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>DateTime</span>
|
454
|
+
<span class='kw'>end</span>
|
455
|
+
|
456
|
+
<span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
457
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>DateTime</span>
|
458
|
+
<span class='kw'>end</span>
|
459
|
+
|
460
|
+
<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_class_eval'>class_eval</span> <span class='kw'>do</span>
|
461
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>TimeZone</span>
|
462
|
+
<span class='kw'>end</span>
|
463
|
+
<span class='kw'>end</span>
|
464
|
+
|
465
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>math</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>then</span>
|
466
|
+
<span class='op'>::</span><span class='const'>Math</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
467
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Math</span>
|
468
|
+
<span class='kw'>end</span>
|
469
|
+
<span class='kw'>end</span>
|
470
|
+
|
471
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_what'>what</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pathname</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>then</span>
|
472
|
+
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>pathname</span><span class='tstring_end'>"</span></span>
|
473
|
+
|
474
|
+
<span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='kw'>do</span>
|
475
|
+
<span class='id identifier rubyid_include'>include</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Pathname</span>
|
476
|
+
<span class='kw'>end</span>
|
477
|
+
<span class='kw'>end</span>
|
478
|
+
|
479
|
+
<span class='kw'>yield</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
480
|
+
|
481
|
+
<span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
482
|
+
<span class='kw'>end</span></pre>
|
485
483
|
</td>
|
486
484
|
</tr>
|
487
485
|
</table>
|
@@ -536,10 +534,9 @@
|
|
536
534
|
<td>
|
537
535
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions.rb', line 38</span>
|
538
536
|
|
539
|
-
<span class='
|
540
|
-
<span class='
|
541
|
-
<span class='
|
542
|
-
</pre>
|
537
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span>
|
538
|
+
<span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
539
|
+
<span class='kw'>end</span></pre>
|
543
540
|
</td>
|
544
541
|
</tr>
|
545
542
|
</table>
|
@@ -550,9 +547,9 @@
|
|
550
547
|
</div>
|
551
548
|
|
552
549
|
<div id="footer">
|
553
|
-
Generated on Fri Jul 20
|
550
|
+
Generated on Fri Jul 20 14:28:06 2012 by
|
554
551
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
555
|
-
0.8.2.1 (ruby-1.
|
552
|
+
0.8.2.1 (ruby-1.9.2).
|
556
553
|
</div>
|
557
554
|
|
558
555
|
</body>
|
@@ -218,10 +218,9 @@
|
|
218
218
|
<td>
|
219
219
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/boolean.rb', line 16</span>
|
220
220
|
|
221
|
-
<span class='
|
222
|
-
|
223
|
-
<span class='
|
224
|
-
</pre>
|
221
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_i'>to_i</span>
|
222
|
+
<span class='lparen'>(</span><span class='kw'>self</span> <span class='op'>==</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='int'>1</span> <span class='op'>:</span> <span class='int'>0</span>
|
223
|
+
<span class='kw'>end</span></pre>
|
225
224
|
</td>
|
226
225
|
</tr>
|
227
226
|
</table>
|
@@ -276,10 +275,9 @@
|
|
276
275
|
<td>
|
277
276
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/boolean.rb', line 23</span>
|
278
277
|
|
279
|
-
<span class='
|
280
|
-
|
281
|
-
<span class='
|
282
|
-
</pre>
|
278
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
|
279
|
+
<span class='kw'>self</span>
|
280
|
+
<span class='kw'>end</span></pre>
|
283
281
|
</td>
|
284
282
|
</tr>
|
285
283
|
</table>
|
@@ -290,9 +288,9 @@
|
|
290
288
|
</div>
|
291
289
|
|
292
290
|
<div id="footer">
|
293
|
-
Generated on Fri Jul 20
|
291
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
294
292
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
295
|
-
0.8.2.1 (ruby-1.
|
293
|
+
0.8.2.1 (ruby-1.9.2).
|
296
294
|
</div>
|
297
295
|
|
298
296
|
</body>
|
@@ -284,9 +284,9 @@
|
|
284
284
|
<div class="discussion">
|
285
285
|
<p>Returns the number of months passed between the beginning of the base year and the current date.</p>
|
286
286
|
|
287
|
-
<pre class="code ruby"><code><span class='
|
288
|
-
<span class='comment
|
289
|
-
</code></pre>
|
287
|
+
<pre class="code ruby"><code><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_civil'>civil</span><span class='lparen'>(</span><span class='int'>2012</span><span class='comma'>,</span> <span class='int'>6</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_in_months'>in_months</span><span class='lparen'>(</span><span class='int'>2011</span><span class='rparen'>)</span>
|
288
|
+
<span class='comment'># => 18
|
289
|
+
</span></code></pre>
|
290
290
|
|
291
291
|
|
292
292
|
</div>
|
@@ -346,11 +346,10 @@
|
|
346
346
|
<td>
|
347
347
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 194</span>
|
348
348
|
|
349
|
-
<span class='
|
350
|
-
<span class='
|
351
|
-
<span class='lparen
|
352
|
-
<span class='
|
353
|
-
</pre>
|
349
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_in_months'>in_months</span><span class='lparen'>(</span><span class='id identifier rubyid_base'>base</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
350
|
+
<span class='id identifier rubyid_base'>base</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>
|
351
|
+
<span class='lparen'>(</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='id identifier rubyid_base'>base</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='int'>12</span> <span class='op'>+</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_month'>month</span>
|
352
|
+
<span class='kw'>end</span></pre>
|
354
353
|
</td>
|
355
354
|
</tr>
|
356
355
|
</table>
|
@@ -433,10 +432,9 @@
|
|
433
432
|
<td>
|
434
433
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 255</span>
|
435
434
|
|
436
|
-
<span class='
|
437
|
-
<span class='lparen
|
438
|
-
<span class='
|
439
|
-
</pre>
|
435
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_local_lstrftime'>local_lstrftime</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
436
|
+
<span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:in_time_zone</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_in_time_zone'>in_time_zone</span> <span class='op'>:</span> <span class='kw'>self</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_lstrftime'>lstrftime</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span>
|
437
|
+
<span class='kw'>end</span></pre>
|
440
438
|
</td>
|
441
439
|
</tr>
|
442
440
|
</table>
|
@@ -512,10 +510,9 @@
|
|
512
510
|
<td>
|
513
511
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 246</span>
|
514
512
|
|
515
|
-
<span class='
|
516
|
-
<span class='lparen
|
517
|
-
<span class='
|
518
|
-
</pre>
|
513
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_local_strftime'>local_strftime</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
514
|
+
<span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:in_time_zone</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_in_time_zone'>in_time_zone</span> <span class='op'>:</span> <span class='kw'>self</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_custom_format'>custom_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
515
|
+
<span class='kw'>end</span></pre>
|
519
516
|
</td>
|
520
517
|
</tr>
|
521
518
|
</table>
|
@@ -625,37 +622,36 @@
|
|
625
622
|
<td>
|
626
623
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 211</span>
|
627
624
|
|
628
|
-
<span class='
|
629
|
-
<span class='
|
630
|
-
<span class='
|
631
|
-
|
632
|
-
<span class='
|
633
|
-
<span class='
|
634
|
-
|
635
|
-
<span class='comment
|
636
|
-
<span class='
|
637
|
-
<span class='
|
638
|
-
<span class='
|
639
|
-
<span class='
|
640
|
-
<span class='
|
641
|
-
<span class='
|
642
|
-
<span class='
|
643
|
-
<span class='
|
644
|
-
<span class='
|
645
|
-
<span class='
|
646
|
-
<span class='
|
647
|
-
<span class='
|
648
|
-
<span class='
|
649
|
-
<span class='
|
650
|
-
<span class='
|
651
|
-
<span class='
|
652
|
-
|
653
|
-
<span class='
|
654
|
-
<span class='
|
655
|
-
|
656
|
-
<span class='
|
657
|
-
<span class='
|
658
|
-
</pre>
|
625
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_lstrftime'>lstrftime</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
626
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
627
|
+
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_date_names'>date_names</span>
|
628
|
+
|
629
|
+
<span class='id identifier rubyid_final_format'>final_format</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_custom_format'>custom_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</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'>(%{1,2}:?[abz])</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_match'>match</span><span class='op'>|</span>
|
630
|
+
<span class='id identifier rubyid_mrv'>mrv</span> <span class='op'>=</span> <span class='id identifier rubyid_match'>match</span>
|
631
|
+
|
632
|
+
<span class='comment'># Handling of %z is to fix ruby 1.8 bug in OSX: http://bugs.ruby-lang.org/issues/2396
|
633
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_match'>match</span> <span class='op'>!~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^%%</span><span class='regexp_end'>/</span></span> <span class='kw'>then</span>
|
634
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_match'>match</span>
|
635
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%a</span><span class='tstring_end'>"</span></span>
|
636
|
+
<span class='id identifier rubyid_mrv'>mrv</span> <span class='op'>=</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='symbol'>:short_days</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_wday'>wday</span><span class='rbracket'>]</span>
|
637
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%A</span><span class='tstring_end'>"</span></span>
|
638
|
+
<span class='id identifier rubyid_mrv'>mrv</span> <span class='op'>=</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='symbol'>:long_days</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_wday'>wday</span><span class='rbracket'>]</span>
|
639
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%b</span><span class='tstring_end'>"</span></span>
|
640
|
+
<span class='id identifier rubyid_mrv'>mrv</span> <span class='op'>=</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='symbol'>:short_months</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_month'>month</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span>
|
641
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%B</span><span class='tstring_end'>"</span></span>
|
642
|
+
<span class='id identifier rubyid_mrv'>mrv</span> <span class='op'>=</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='symbol'>:long_months</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_month'>month</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span>
|
643
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%z</span><span class='tstring_end'>"</span></span>
|
644
|
+
<span class='id identifier rubyid_mrv'>mrv</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_is_ruby_18?'>is_ruby_18?</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_formatted_offset'>formatted_offset</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
645
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%:z</span><span class='tstring_end'>"</span></span>
|
646
|
+
<span class='id identifier rubyid_mrv'>mrv</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_is_ruby_18?'>is_ruby_18?</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_formatted_offset'>formatted_offset</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
647
|
+
<span class='kw'>end</span>
|
648
|
+
<span class='kw'>end</span>
|
649
|
+
|
650
|
+
<span class='id identifier rubyid_mrv'>mrv</span> <span class='op'>?</span> <span class='id identifier rubyid_mrv'>mrv</span><span class='period'>.</span><span class='id identifier rubyid_sub'>sub</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> <span class='op'>:</span> <span class='id identifier rubyid_match'>match</span>
|
651
|
+
<span class='kw'>end</span>
|
652
|
+
|
653
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='id identifier rubyid_final_format'>final_format</span><span class='rparen'>)</span>
|
654
|
+
<span class='kw'>end</span></pre>
|
659
655
|
</td>
|
660
656
|
</tr>
|
661
657
|
</table>
|
@@ -710,10 +706,9 @@
|
|
710
706
|
<td>
|
711
707
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 202</span>
|
712
708
|
|
713
|
-
<span class='
|
714
|
-
<span class='
|
715
|
-
<span class='
|
716
|
-
</pre>
|
709
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_padded_month'>padded_month</span>
|
710
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_month'>month</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_rjust'>rjust</span><span class='lparen'>(</span><span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
711
|
+
<span class='kw'>end</span></pre>
|
717
712
|
</td>
|
718
713
|
</tr>
|
719
714
|
</table>
|
@@ -769,11 +764,10 @@
|
|
769
764
|
<td>
|
770
765
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 180</span>
|
771
766
|
|
772
|
-
<span class='
|
773
|
-
<span class='
|
774
|
-
<span class='
|
775
|
-
<span class='
|
776
|
-
</pre>
|
767
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_utc_time'>utc_time</span>
|
768
|
+
<span class='id identifier rubyid_ua'>ua</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:utc</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_datetime'>to_datetime</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span>
|
769
|
+
<span class='op'>::</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='lparen'>(</span><span class='id identifier rubyid_ua'>ua</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='id identifier rubyid_ua'>ua</span><span class='period'>.</span><span class='id identifier rubyid_month'>month</span><span class='comma'>,</span> <span class='id identifier rubyid_ua'>ua</span><span class='period'>.</span><span class='id identifier rubyid_day'>day</span><span class='comma'>,</span> <span class='id identifier rubyid_ua'>ua</span><span class='period'>.</span><span class='id identifier rubyid_hour'>hour</span><span class='comma'>,</span> <span class='id identifier rubyid_ua'>ua</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='comma'>,</span> <span class='id identifier rubyid_ua'>ua</span><span class='period'>.</span><span class='id identifier rubyid_sec'>sec</span><span class='rparen'>)</span>
|
770
|
+
<span class='kw'>end</span></pre>
|
777
771
|
</td>
|
778
772
|
</tr>
|
779
773
|
</table>
|
@@ -784,9 +778,9 @@
|
|
784
778
|
</div>
|
785
779
|
|
786
780
|
<div id="footer">
|
787
|
-
Generated on Fri Jul 20
|
781
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
788
782
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
789
|
-
0.8.2.1 (ruby-1.
|
783
|
+
0.8.2.1 (ruby-1.9.2).
|
790
784
|
</div>
|
791
785
|
|
792
786
|
</body>
|
@@ -469,10 +469,9 @@
|
|
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='
|
473
|
-
<span class='
|
474
|
-
<span class='
|
475
|
-
</pre>
|
472
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_custom_format'>custom_format</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
473
|
+
<span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_date_formats'>date_formats</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
474
|
+
<span class='kw'>end</span></pre>
|
476
475
|
</td>
|
477
476
|
</tr>
|
478
477
|
</table>
|
@@ -559,14 +558,13 @@
|
|
559
558
|
<td>
|
560
559
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 20</span>
|
561
560
|
|
562
|
-
<span class='
|
563
|
-
<span class='
|
564
|
-
<span class='lparen
|
565
|
-
<span class='lbrace
|
566
|
-
<span class='rbrace
|
561
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_days'>days</span><span class='lparen'>(</span><span class='id identifier rubyid_short'>short</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
562
|
+
<span class='id identifier rubyid_days'>days</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_date_names'>date_names</span><span class='lbracket'>[</span><span class='id identifier rubyid_short'>short</span> <span class='op'>?</span> <span class='symbol'>:short_days</span> <span class='op'>:</span> <span class='symbol'>:long_days</span><span class='rbracket'>]</span>
|
563
|
+
<span class='lparen'>(</span><span class='int'>1</span><span class='op'>..</span><span class='int'>7</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
564
|
+
<span class='lbrace'>{</span><span class='symbol'>:value</span> <span class='op'>=></span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span> <span class='symbol'>:label</span><span class='op'>=></span> <span class='id identifier rubyid_days'>days</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span> <span class='op'>-</span> <span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
565
|
+
<span class='rbrace'>}</span>
|
567
566
|
|
568
|
-
<span class='
|
569
|
-
</pre>
|
567
|
+
<span class='kw'>end</span></pre>
|
570
568
|
</td>
|
571
569
|
</tr>
|
572
570
|
</table>
|
@@ -667,28 +665,27 @@
|
|
667
665
|
<td>
|
668
666
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 125</span>
|
669
667
|
|
670
|
-
<span class='
|
671
|
-
<span class='
|
672
|
-
|
673
|
-
<span class='comment
|
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
|
-
<span class='
|
685
|
-
<span class='
|
686
|
-
|
687
|
-
<span class='
|
688
|
-
<span class='
|
689
|
-
<span class='
|
690
|
-
<span class='
|
691
|
-
</pre>
|
668
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_easter'>easter</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>
|
669
|
+
<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> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_year'>year</span><span class='period'>.</span><span class='id identifier rubyid_is_integer?'>is_integer?</span>
|
670
|
+
|
671
|
+
<span class='comment'># Compute using Anonymouse Gregorian Algorithm: http://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm
|
672
|
+
</span> <span class='id identifier rubyid_a'>a</span> <span class='op'>=</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>%</span> <span class='int'>19</span>
|
673
|
+
<span class='id identifier rubyid_b'>b</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span> <span class='op'>/</span> <span class='float'>100.0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span>
|
674
|
+
<span class='id identifier rubyid_c'>c</span> <span class='op'>=</span> <span class='id identifier rubyid_year'>year</span> <span class='op'>%</span> <span class='int'>100</span>
|
675
|
+
<span class='id identifier rubyid_d'>d</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_b'>b</span> <span class='op'>/</span> <span class='float'>4.0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span>
|
676
|
+
<span class='id identifier rubyid_e'>e</span> <span class='op'>=</span> <span class='id identifier rubyid_b'>b</span> <span class='op'>%</span> <span class='int'>4</span>
|
677
|
+
<span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_b'>b</span> <span class='op'>+</span> <span class='int'>8</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='float'>25.0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span>
|
678
|
+
<span class='id identifier rubyid_g'>g</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_b'>b</span> <span class='op'>-</span> <span class='id identifier rubyid_f'>f</span> <span class='op'>+</span> <span class='int'>1</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='float'>3.0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span>
|
679
|
+
<span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='int'>19</span> <span class='op'>*</span> <span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_b'>b</span> <span class='op'>-</span> <span class='id identifier rubyid_d'>d</span> <span class='op'>-</span> <span class='id identifier rubyid_g'>g</span> <span class='op'>+</span> <span class='int'>15</span><span class='rparen'>)</span> <span class='op'>%</span> <span class='int'>30</span>
|
680
|
+
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_c'>c</span> <span class='op'>/</span> <span class='float'>4.0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span>
|
681
|
+
<span class='id identifier rubyid_k'>k</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span> <span class='op'>%</span> <span class='int'>4</span>
|
682
|
+
<span class='id identifier rubyid_l'>l</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='int'>32</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='int'>2</span> <span class='op'>*</span> <span class='id identifier rubyid_e'>e</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='int'>2</span> <span class='op'>*</span> <span class='id identifier rubyid_i'>i</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='id identifier rubyid_h'>h</span> <span class='op'>-</span> <span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span> <span class='op'>%</span> <span class='int'>7</span>
|
683
|
+
<span class='id identifier rubyid_m'>m</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='int'>11</span> <span class='op'>*</span> <span class='id identifier rubyid_h'>h</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='int'>22</span> <span class='op'>*</span> <span class='id identifier rubyid_l'>l</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='float'>451.0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span>
|
684
|
+
|
685
|
+
<span class='id identifier rubyid_day'>day</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_h'>h</span> <span class='op'>+</span> <span class='id identifier rubyid_l'>l</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='int'>7</span> <span class='op'>*</span> <span class='id identifier rubyid_m'>m</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>114</span><span class='rparen'>)</span> <span class='op'>%</span> <span class='int'>31</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>1</span>
|
686
|
+
<span class='id identifier rubyid_month'>month</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_h'>h</span> <span class='op'>+</span> <span class='id identifier rubyid_l'>l</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='int'>7</span> <span class='op'>*</span> <span class='id identifier rubyid_m'>m</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='int'>114</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='float'>31.0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_floor'>floor</span>
|
687
|
+
<span class='op'>::</span><span class='const'>Date</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='id identifier rubyid_month'>month</span><span class='comma'>,</span> <span class='id identifier rubyid_day'>day</span><span class='rparen'>)</span>
|
688
|
+
<span class='kw'>end</span></pre>
|
692
689
|
</td>
|
693
690
|
</tr>
|
694
691
|
</table>
|
@@ -781,10 +778,9 @@
|
|
781
778
|
<td>
|
782
779
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 84</span>
|
783
780
|
|
784
|
-
<span class='
|
785
|
-
<span class='
|
786
|
-
<span class='
|
787
|
-
</pre>
|
781
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_timezone'>find_timezone</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
782
|
+
<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_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span><span class='rparen'>)</span>
|
783
|
+
<span class='kw'>end</span></pre>
|
788
784
|
</td>
|
789
785
|
</tr>
|
790
786
|
</table>
|
@@ -892,20 +888,19 @@
|
|
892
888
|
<td>
|
893
889
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 162</span>
|
894
890
|
|
895
|
-
<span class='
|
896
|
-
<span class='
|
891
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_valid?'>is_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</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='rparen'>)</span>
|
892
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>true</span>
|
897
893
|
|
898
|
-
<span class='
|
894
|
+
<span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_custom_format'>custom_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span>
|
899
895
|
|
900
|
-
<span class='
|
901
|
-
<span class='
|
902
|
-
<span class='
|
903
|
-
<span class='
|
904
|
-
<span class='
|
896
|
+
<span class='kw'>begin</span>
|
897
|
+
<span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_strptime'>strptime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span>
|
898
|
+
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
899
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>false</span>
|
900
|
+
<span class='kw'>end</span>
|
905
901
|
|
906
|
-
<span class='
|
907
|
-
<span class='
|
908
|
-
</pre>
|
902
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
903
|
+
<span class='kw'>end</span></pre>
|
909
904
|
</td>
|
910
905
|
</tr>
|
911
906
|
</table>
|
@@ -998,10 +993,9 @@
|
|
998
993
|
<td>
|
999
994
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 75</span>
|
1000
995
|
|
1001
|
-
<span class='
|
1002
|
-
<span class='
|
1003
|
-
<span class='
|
1004
|
-
</pre>
|
996
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_list_timezones'>list_timezones</span><span class='lparen'>(</span><span class='id identifier rubyid_with_dst'>with_dst</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
997
|
+
<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_list_all'>list_all</span><span class='lparen'>(</span><span class='id identifier rubyid_with_dst'>with_dst</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span><span class='rparen'>)</span>
|
998
|
+
<span class='kw'>end</span></pre>
|
1005
999
|
</td>
|
1006
1000
|
</tr>
|
1007
1001
|
</table>
|
@@ -1087,13 +1081,12 @@
|
|
1087
1081
|
<td>
|
1088
1082
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 33</span>
|
1089
1083
|
|
1090
|
-
<span class='
|
1091
|
-
<span class='
|
1092
|
-
<span class='lparen
|
1093
|
-
<span class='lbrace
|
1094
|
-
<span class='rbrace
|
1095
|
-
<span class='
|
1096
|
-
</pre>
|
1084
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_months'>months</span><span class='lparen'>(</span><span class='id identifier rubyid_short'>short</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1085
|
+
<span class='id identifier rubyid_months'>months</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Cowtech</span><span class='op'>::</span><span class='const'>Extensions</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_date_names'>date_names</span><span class='lbracket'>[</span><span class='id identifier rubyid_short'>short</span> <span class='op'>?</span> <span class='symbol'>:short_months</span> <span class='op'>:</span> <span class='symbol'>:long_months</span><span class='rbracket'>]</span>
|
1086
|
+
<span class='lparen'>(</span><span class='int'>1</span><span class='op'>..</span><span class='int'>12</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
1087
|
+
<span class='lbrace'>{</span><span class='symbol'>:value</span> <span class='op'>=></span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_rjust'>rjust</span><span class='lparen'>(</span><span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='symbol'>:label</span><span class='op'>=></span> <span class='id identifier rubyid_months'>months</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
1088
|
+
<span class='rbrace'>}</span>
|
1089
|
+
<span class='kw'>end</span></pre>
|
1097
1090
|
</td>
|
1098
1091
|
</tr>
|
1099
1092
|
</table>
|
@@ -1112,9 +1105,9 @@
|
|
1112
1105
|
<div class="discussion">
|
1113
1106
|
<p>Returns a string representation of a timezone.</p>
|
1114
1107
|
|
1115
|
-
<pre class="code ruby"><code><span class='
|
1116
|
-
<span class='comment
|
1117
|
-
</code></pre>
|
1108
|
+
<pre class="code ruby"><code><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Pacific Time (US & Canada)</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1109
|
+
<span class='comment'># => "-0800@pacific-time-us-canada"
|
1110
|
+
</span></code></pre>
|
1118
1111
|
|
1119
1112
|
|
1120
1113
|
</div>
|
@@ -1188,10 +1181,9 @@
|
|
1188
1181
|
<td>
|
1189
1182
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 97</span>
|
1190
1183
|
|
1191
|
-
<span class='
|
1192
|
-
<span class='
|
1193
|
-
<span class='
|
1194
|
-
</pre>
|
1184
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</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='rparen'>)</span>
|
1185
|
+
<span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='op'>::</span><span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span><span class='rparen'>)</span>
|
1186
|
+
<span class='kw'>end</span></pre>
|
1195
1187
|
</td>
|
1196
1188
|
</tr>
|
1197
1189
|
</table>
|
@@ -1265,10 +1257,9 @@
|
|
1265
1257
|
<td>
|
1266
1258
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 116</span>
|
1267
1259
|
|
1268
|
-
<span class='
|
1269
|
-
<span class='
|
1270
|
-
<span class='
|
1271
|
-
</pre>
|
1260
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_offset'>offset</span><span class='rparen'>)</span>
|
1261
|
+
<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_rationalize_offset'>rationalize_offset</span><span class='lparen'>(</span><span class='id identifier rubyid_offset'>offset</span><span class='rparen'>)</span>
|
1262
|
+
<span class='kw'>end</span></pre>
|
1272
1263
|
</td>
|
1273
1264
|
</tr>
|
1274
1265
|
</table>
|
@@ -1323,10 +1314,9 @@
|
|
1323
1314
|
<td>
|
1324
1315
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 66</span>
|
1325
1316
|
|
1326
|
-
<span class='
|
1327
|
-
<span class='
|
1328
|
-
<span class='
|
1329
|
-
</pre>
|
1317
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_timezones'>timezones</span>
|
1318
|
+
<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_all'>all</span>
|
1319
|
+
<span class='kw'>end</span></pre>
|
1330
1320
|
</td>
|
1331
1321
|
</tr>
|
1332
1322
|
</table>
|
@@ -1441,10 +1431,9 @@
|
|
1441
1431
|
<td>
|
1442
1432
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 108</span>
|
1443
1433
|
|
1444
|
-
<span class='
|
1445
|
-
<span class='
|
1446
|
-
<span class='
|
1447
|
-
</pre>
|
1434
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_unparameterize_zone'>unparameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_as_string'>as_string</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1435
|
+
<span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='op'>::</span><span class='id identifier rubyid_unparameterize_zone'>unparameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_as_string'>as_string</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span><span class='rparen'>)</span>
|
1436
|
+
<span class='kw'>end</span></pre>
|
1448
1437
|
</td>
|
1449
1438
|
</tr>
|
1450
1439
|
</table>
|
@@ -1463,13 +1452,13 @@
|
|
1463
1452
|
<div class="discussion">
|
1464
1453
|
<p>Returns a range of years.</p>
|
1465
1454
|
|
1466
|
-
<pre class="code ruby"><code><span class='
|
1467
|
-
<span class='comment
|
1468
|
-
</code></pre>
|
1455
|
+
<pre class="code ruby"><code><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_years'>years</span><span class='lparen'>(</span><span class='int'>3</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='int'>2010</span><span class='rparen'>)</span>
|
1456
|
+
<span class='comment'># => [2007, 2008, 2009, 2010]
|
1457
|
+
</span></code></pre>
|
1469
1458
|
|
1470
|
-
<pre class="code ruby"><code><span class='
|
1471
|
-
<span class='comment
|
1472
|
-
</code></pre>
|
1459
|
+
<pre class="code ruby"><code><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_years'>years</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='int'>2010</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1460
|
+
<span class='comment'># => [{:value=>2009, :label=>2009}, {:value=>2010, :label=>2010}, {:value=>2011, :label=>2011}]
|
1461
|
+
</span></code></pre>
|
1473
1462
|
|
1474
1463
|
|
1475
1464
|
</div>
|
@@ -1580,11 +1569,10 @@
|
|
1580
1569
|
<td>
|
1581
1570
|
<pre class="code"><span class="info file"># File 'lib/cowtech-extensions/datetime.rb', line 58</span>
|
1582
1571
|
|
1583
|
-
<span class='
|
1584
|
-
<span class='
|
1585
|
-
<span class='lparen
|
1586
|
-
<span class='
|
1587
|
-
</pre>
|
1572
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_years'>years</span><span class='lparen'>(</span><span class='id identifier rubyid_offset'>offset</span> <span class='op'>=</span> <span class='int'>10</span><span class='comma'>,</span> <span class='id identifier rubyid_also_future'>also_future</span> <span class='op'>=</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_reference'>reference</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_as_objects'>as_objects</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
1573
|
+
<span class='id identifier rubyid_y'>y</span> <span class='op'>=</span> <span class='id identifier rubyid_reference'>reference</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>
|
1574
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_y'>y</span> <span class='op'>-</span> <span class='id identifier rubyid_offset'>offset</span><span class='op'>..</span><span class='lparen'>(</span><span class='id identifier rubyid_also_future'>also_future</span> <span class='op'>?</span> <span class='id identifier rubyid_y'>y</span> <span class='op'>+</span> <span class='id identifier rubyid_offset'>offset</span> <span class='op'>:</span> <span class='id identifier rubyid_y'>y</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_year'>year</span><span class='op'>|</span> <span class='id identifier rubyid_as_objects'>as_objects</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='symbol'>:value</span> <span class='op'>=></span> <span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='symbol'>:label</span> <span class='op'>=></span> <span class='id identifier rubyid_year'>year</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='id identifier rubyid_year'>year</span> <span class='rbrace'>}</span>
|
1575
|
+
<span class='kw'>end</span></pre>
|
1588
1576
|
</td>
|
1589
1577
|
</tr>
|
1590
1578
|
</table>
|
@@ -1595,9 +1583,9 @@
|
|
1595
1583
|
</div>
|
1596
1584
|
|
1597
1585
|
<div id="footer">
|
1598
|
-
Generated on Fri Jul 20
|
1586
|
+
Generated on Fri Jul 20 14:28:07 2012 by
|
1599
1587
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1600
|
-
0.8.2.1 (ruby-1.
|
1588
|
+
0.8.2.1 (ruby-1.9.2).
|
1601
1589
|
</div>
|
1602
1590
|
|
1603
1591
|
</body>
|