doc/TaskJuggler/TjTime.html in taskjuggler-0.0.8 vs doc/TaskJuggler/TjTime.html in taskjuggler-0.0.9

- old
+ new

@@ -223,10 +223,12 @@ <li><a href="../TaskJuggler/AttributeBase.html">TaskJuggler::AttributeBase</a></li> <li><a href="../TaskJuggler/AttributeDefinition.html">TaskJuggler::AttributeDefinition</a></li> + <li><a href="../TaskJuggler/AttributeOverwrite.html">TaskJuggler::AttributeOverwrite</a></li> + <li><a href="../TaskJuggler/BatchProcessor.html">TaskJuggler::BatchProcessor</a></li> <li><a href="../TaskJuggler/Booking.html">TaskJuggler::Booking</a></li> <li><a href="../TaskJuggler/BookingListAttribute.html">TaskJuggler::BookingListAttribute</a></li> @@ -301,10 +303,12 @@ <li><a href="../TaskJuggler/HTMLGraphics.html">TaskJuggler::HTMLGraphics</a></li> <li><a href="../TaskJuggler/Interval.html">TaskJuggler::Interval</a></li> + <li><a href="../TaskJuggler/IntervalList.html">TaskJuggler::IntervalList</a></li> + <li><a href="../TaskJuggler/IntervalListAttribute.html">TaskJuggler::IntervalListAttribute</a></li> <li><a href="../TaskJuggler/JobInfo.html">TaskJuggler::JobInfo</a></li> <li><a href="../TaskJuggler/Journal.html">TaskJuggler::Journal</a></li> @@ -333,10 +337,12 @@ <li><a href="../TaskJuggler/LogicalExpression.html">TaskJuggler::LogicalExpression</a></li> <li><a href="../TaskJuggler/LogicalExpressionAttribute.html">TaskJuggler::LogicalExpressionAttribute</a></li> + <li><a href="../TaskJuggler/LogicalExpressionListAttribute.html">TaskJuggler::LogicalExpressionListAttribute</a></li> + <li><a href="../TaskJuggler/LogicalFlag.html">TaskJuggler::LogicalFlag</a></li> <li><a href="../TaskJuggler/LogicalFunction.html">TaskJuggler::LogicalFunction</a></li> <li><a href="../TaskJuggler/LogicalOperation.html">TaskJuggler::LogicalOperation</a></li> @@ -613,10 +619,12 @@ <li><a href="../TaskJuggler/VimSyntax.html">TaskJuggler::VimSyntax</a></li> <li><a href="../TaskJuggler/WebServer.html">TaskJuggler::WebServer</a></li> + <li><a href="../TaskJuggler/WelcomePage.html">TaskJuggler::WelcomePage</a></li> + <li><a href="../TaskJuggler/WorkingHours.html">TaskJuggler::WorkingHours</a></li> <li><a href="../TaskJuggler/WorkingHoursAttribute.html">TaskJuggler::WorkingHoursAttribute</a></li> <li><a href="../TaskJuggler/XMLBlob.html">TaskJuggler::XMLBlob</a></li> @@ -639,12 +647,10 @@ <li><a href="../RuntimeConfig.html">RuntimeConfig</a></li> <li><a href="../String.html">String</a></li> - <li><a href="../StringIO.html">StringIO</a></li> - </ul> <div id="no-class-search-results" style="display: none;">No matching classes.</div> </div> @@ -729,37 +735,37 @@ <div class="method-source-code" id="check-ime-one-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 168</span> -168: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">checkTimeZone</span>(<span class="ruby-identifier">zone</span>) -169: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span> -170: -171: <span class="ruby-comment cmt"># Valid time zones must be of the form 'Region/City'</span> -172: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">'/'</span>) -173: -174: <span class="ruby-comment cmt"># Save curent value of TZ</span> -175: <span class="ruby-identifier">tz</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] -176: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">zone</span> -177: <span class="ruby-identifier">newZone</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">zone</span> -178: <span class="ruby-comment cmt"># If the time zone is valid, the OS can convert a zone like</span> -179: <span class="ruby-comment cmt"># 'America/Denver' into 'MST'. Unknown time zones are either not</span> -180: <span class="ruby-comment cmt"># converted or cause a fallback to UTC.</span> -181: <span class="ruby-comment cmt"># Since glibc 2.10 Time.new.zone only return the region for illegal</span> -182: <span class="ruby-comment cmt"># zones instead of the full zone string like it does on earlier</span> -183: <span class="ruby-comment cmt"># versions.</span> -184: <span class="ruby-identifier">region</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">zone</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">'/'</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] -185: <span class="ruby-identifier">res</span> = (<span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">region</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'UTC'</span>) -186: <span class="ruby-comment cmt"># Restore TZ if it was set earlier.</span> -187: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tz</span> -188: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">tz</span> -189: <span class="ruby-keyword kw">else</span> -190: <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'TZ'</span>) -191: <span class="ruby-keyword kw">end</span> -192: <span class="ruby-identifier">res</span> -193: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 169</span> +169: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">checkTimeZone</span>(<span class="ruby-identifier">zone</span>) +170: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'UTC'</span> +171: +172: <span class="ruby-comment cmt"># Valid time zones must be of the form 'Region/City'</span> +173: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">'/'</span>) +174: +175: <span class="ruby-comment cmt"># Save curent value of TZ</span> +176: <span class="ruby-identifier">tz</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] +177: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">zone</span> +178: <span class="ruby-identifier">newZone</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">zone</span> +179: <span class="ruby-comment cmt"># If the time zone is valid, the OS can convert a zone like</span> +180: <span class="ruby-comment cmt"># 'America/Denver' into 'MST'. Unknown time zones are either not</span> +181: <span class="ruby-comment cmt"># converted or cause a fallback to UTC.</span> +182: <span class="ruby-comment cmt"># Since glibc 2.10 Time.new.zone only return the region for illegal</span> +183: <span class="ruby-comment cmt"># zones instead of the full zone string like it does on earlier</span> +184: <span class="ruby-comment cmt"># versions.</span> +185: <span class="ruby-identifier">region</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">zone</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">'/'</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] +186: <span class="ruby-identifier">res</span> = (<span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">zone</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">region</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">newZone</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'UTC'</span>) +187: <span class="ruby-comment cmt"># Restore TZ if it was set earlier.</span> +188: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tz</span> +189: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TZ'</span>] = <span class="ruby-identifier">tz</span> +190: <span class="ruby-keyword kw">else</span> +191: <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'TZ'</span>) +192: <span class="ruby-keyword kw">end</span> +193: <span class="ruby-identifier">res</span> +194: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -789,14 +795,14 @@ <div class="method-source-code" id="gm-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 52</span> -52: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">gm</span>(*<span class="ruby-identifier">args</span>) -53: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">gm</span>(*<span class="ruby-identifier">args</span>)) -54: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 53</span> +53: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">gm</span>(*<span class="ruby-identifier">args</span>) +54: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">gm</span>(*<span class="ruby-identifier">args</span>)) +55: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -826,14 +832,14 @@ <div class="method-source-code" id="local-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 58</span> -58: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">args</span>) -59: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">args</span>).<span class="ruby-identifier">gmtime</span>) -60: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 59</span> +59: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">args</span>) +60: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">args</span>).<span class="ruby-identifier">gmtime</span>) +61: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -866,20 +872,20 @@ <div class="method-source-code" id="new-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 35</span> -35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">t</span>) -36: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Time</span>) -37: <span class="ruby-ivar">@time</span> = <span class="ruby-identifier">t</span> -38: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) -39: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">t</span>).<span class="ruby-identifier">time</span> -40: <span class="ruby-keyword kw">else</span> -41: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">t</span>) -42: <span class="ruby-keyword kw">end</span> -43: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 36</span> +36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">t</span>) +37: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Time</span>) +38: <span class="ruby-ivar">@time</span> = <span class="ruby-identifier">t</span> +39: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) +40: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">t</span>).<span class="ruby-identifier">time</span> +41: <span class="ruby-keyword kw">else</span> +42: <span class="ruby-ivar">@time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">t</span>) +43: <span class="ruby-keyword kw">end</span> +44: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -908,14 +914,14 @@ <div class="method-source-code" id="now-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 46</span> -46: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">now</span> -47: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">gmtime</span>) -48: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 47</span> +47: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">now</span> +48: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">gmtime</span>) +49: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -942,115 +948,115 @@ <div class="method-source-code" id="parse-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 62</span> - 62: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">t</span>) - 63: <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">time</span>, <span class="ruby-identifier">zone</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'-'</span>, <span class="ruby-value">5</span>) - 64: - 65: <span class="ruby-comment cmt"># Check the year</span> - 66: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> - 67: <span class="ruby-identifier">year</span> = <span class="ruby-identifier">year</span>.<span class="ruby-identifier">to_i</span> - 68: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1970</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">2035</span> - 69: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Year #{year} out of range (1970 - 2035)&quot;</span> - 70: <span class="ruby-keyword kw">end</span> - 71: <span class="ruby-keyword kw">else</span> - 72: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Year not specified&quot;</span> - 73: <span class="ruby-keyword kw">end</span> - 74: - 75: <span class="ruby-comment cmt"># Check the month</span> - 76: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> - 77: <span class="ruby-identifier">month</span> = <span class="ruby-identifier">month</span>.<span class="ruby-identifier">to_i</span> - 78: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> - 79: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Month #{month} out of range (1 - 12)&quot;</span> - 80: <span class="ruby-keyword kw">end</span> - 81: <span class="ruby-keyword kw">else</span> - 82: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Month not specified&quot;</span> - 83: <span class="ruby-keyword kw">end</span> - 84: - 85: <span class="ruby-comment cmt"># Check the day</span> - 86: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">day</span> - 87: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">day</span>.<span class="ruby-identifier">to_i</span> - 88: <span class="ruby-identifier">maxDay</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">31</span>, <span class="ruby-constant">Date</span>.<span class="ruby-identifier">gregorian_leap?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-value">28</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, - 89: <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span> ] - 90: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">maxDay</span>[<span class="ruby-identifier">month</span>] - 91: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Day #{day} out of range (1 - #{maxDay[month]})&quot;</span> - 92: <span class="ruby-keyword kw">end</span> - 93: <span class="ruby-keyword kw">else</span> - 94: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Day not specified&quot;</span> - 95: <span class="ruby-keyword kw">end</span> - 96: - 97: <span class="ruby-comment cmt"># The time is optional. Will be expanded to 00:00:00.</span> - 98: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">time</span> - 99: <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">':'</span>) -100: -101: <span class="ruby-comment cmt"># Check hour</span> -102: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hour</span> -103: <span class="ruby-identifier">hour</span> = <span class="ruby-identifier">hour</span>.<span class="ruby-identifier">to_i</span> -104: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hour</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">hour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">23</span> -105: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Hour #{hour} out of range (0 - 23)&quot;</span> -106: <span class="ruby-keyword kw">end</span> -107: <span class="ruby-keyword kw">else</span> -108: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Hour not specified&quot;</span> -109: <span class="ruby-keyword kw">end</span> -110: -111: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">minute</span> -112: <span class="ruby-identifier">minute</span> = <span class="ruby-identifier">minute</span>.<span class="ruby-identifier">to_i</span> -113: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">minute</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">minute</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> -114: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Minute #{minute} out of range (0 - 59)&quot;</span> -115: <span class="ruby-keyword kw">end</span> -116: <span class="ruby-keyword kw">else</span> -117: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Minute not specified&quot;</span> -118: <span class="ruby-keyword kw">end</span> -119: -120: <span class="ruby-comment cmt"># Check sencond. This value is optional and defaults to 0.</span> -121: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span> -122: <span class="ruby-identifier">second</span> = <span class="ruby-identifier">second</span>.<span class="ruby-identifier">to_i</span> -123: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">second</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> -124: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Second #{second} out of range (0 - 59)&quot;</span> -125: <span class="ruby-keyword kw">end</span> -126: <span class="ruby-keyword kw">else</span> -127: <span class="ruby-identifier">second</span> = <span class="ruby-value">0</span> -128: <span class="ruby-keyword kw">end</span> -129: <span class="ruby-keyword kw">else</span> -130: <span class="ruby-identifier">hour</span> = <span class="ruby-identifier">minute</span> = <span class="ruby-identifier">second</span> = <span class="ruby-value">0</span> -131: <span class="ruby-keyword kw">end</span> -132: -133: <span class="ruby-comment cmt"># The zone is optional and defaults to the current time zone.</span> -134: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span> -135: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">--</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">++</span> -136: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment must be prefixed by &quot;</span> <span class="ruby-operator">+</span> -137: <span class="ruby-node">&quot;+ or -, not #{zone[0]}&quot;</span> -138: <span class="ruby-keyword kw">end</span> -139: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-value">5</span> -140: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment must use (+/-)HHMM format&quot;</span> -141: <span class="ruby-keyword kw">end</span> -142: -143: <span class="ruby-identifier">date</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span>) -144: <span class="ruby-identifier">sign</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">--</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span> -145: <span class="ruby-identifier">tzHour</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span> -146: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tzHour</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tzHour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -147: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment hour out of range &quot;</span> <span class="ruby-operator">+</span> -148: <span class="ruby-node">&quot;(0 - 12) but is #{tzHour}&quot;</span> -149: <span class="ruby-keyword kw">end</span> -150: <span class="ruby-identifier">tzMinute</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">3</span><span class="ruby-operator">..</span><span class="ruby-value">4</span>].<span class="ruby-identifier">to_i</span> -151: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tzMinute</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tzMinute</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> -152: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment minute out of range &quot;</span> <span class="ruby-operator">+</span> -153: <span class="ruby-node">&quot;(0 - 59) but is #{tzMinute}&quot;</span> -154: <span class="ruby-keyword kw">end</span> -155: <span class="ruby-identifier">date</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sign</span> * (<span class="ruby-identifier">tzHour</span> * <span class="ruby-value">3600</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">tzMinute</span> * <span class="ruby-value">60</span>) -156: <span class="ruby-keyword kw">else</span> -157: <span class="ruby-identifier">date</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span>) -158: <span class="ruby-keyword kw">end</span> -159: -160: <span class="ruby-comment cmt">#puts &quot;--&gt; #{t}&quot;</span> -161: <span class="ruby-comment cmt">#puts(&quot;&gt;&gt;&gt; #{year}-#{month}-#{day}-#{hour}:#{minute}:#{second}&quot; +</span> -162: <span class="ruby-comment cmt"># &quot;#{zone ? &quot;-#{tzHour}:#{tzMinute}&quot; : &quot;&quot;}&quot;)</span> -163: <span class="ruby-comment cmt">#puts &quot;=== #{date}&quot;</span> -164: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">date</span>) -165: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 63</span> + 63: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">t</span>) + 64: <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">time</span>, <span class="ruby-identifier">zone</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'-'</span>, <span class="ruby-value">5</span>) + 65: + 66: <span class="ruby-comment cmt"># Check the year</span> + 67: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> + 68: <span class="ruby-identifier">year</span> = <span class="ruby-identifier">year</span>.<span class="ruby-identifier">to_i</span> + 69: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1970</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">2035</span> + 70: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Year #{year} out of range (1970 - 2035)&quot;</span> + 71: <span class="ruby-keyword kw">end</span> + 72: <span class="ruby-keyword kw">else</span> + 73: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Year not specified&quot;</span> + 74: <span class="ruby-keyword kw">end</span> + 75: + 76: <span class="ruby-comment cmt"># Check the month</span> + 77: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> + 78: <span class="ruby-identifier">month</span> = <span class="ruby-identifier">month</span>.<span class="ruby-identifier">to_i</span> + 79: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> + 80: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Month #{month} out of range (1 - 12)&quot;</span> + 81: <span class="ruby-keyword kw">end</span> + 82: <span class="ruby-keyword kw">else</span> + 83: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Month not specified&quot;</span> + 84: <span class="ruby-keyword kw">end</span> + 85: + 86: <span class="ruby-comment cmt"># Check the day</span> + 87: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">day</span> + 88: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">day</span>.<span class="ruby-identifier">to_i</span> + 89: <span class="ruby-identifier">maxDay</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">31</span>, <span class="ruby-constant">Date</span>.<span class="ruby-identifier">gregorian_leap?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-value">28</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, + 90: <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span>, <span class="ruby-value">30</span>, <span class="ruby-value">31</span> ] + 91: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">maxDay</span>[<span class="ruby-identifier">month</span>] + 92: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Day #{day} out of range (1 - #{maxDay[month]})&quot;</span> + 93: <span class="ruby-keyword kw">end</span> + 94: <span class="ruby-keyword kw">else</span> + 95: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Day not specified&quot;</span> + 96: <span class="ruby-keyword kw">end</span> + 97: + 98: <span class="ruby-comment cmt"># The time is optional. Will be expanded to 00:00:00.</span> + 99: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">time</span> +100: <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span> = <span class="ruby-identifier">time</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">':'</span>) +101: +102: <span class="ruby-comment cmt"># Check hour</span> +103: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hour</span> +104: <span class="ruby-identifier">hour</span> = <span class="ruby-identifier">hour</span>.<span class="ruby-identifier">to_i</span> +105: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hour</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">hour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">23</span> +106: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Hour #{hour} out of range (0 - 23)&quot;</span> +107: <span class="ruby-keyword kw">end</span> +108: <span class="ruby-keyword kw">else</span> +109: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Hour not specified&quot;</span> +110: <span class="ruby-keyword kw">end</span> +111: +112: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">minute</span> +113: <span class="ruby-identifier">minute</span> = <span class="ruby-identifier">minute</span>.<span class="ruby-identifier">to_i</span> +114: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">minute</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">minute</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> +115: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Minute #{minute} out of range (0 - 59)&quot;</span> +116: <span class="ruby-keyword kw">end</span> +117: <span class="ruby-keyword kw">else</span> +118: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Minute not specified&quot;</span> +119: <span class="ruby-keyword kw">end</span> +120: +121: <span class="ruby-comment cmt"># Check sencond. This value is optional and defaults to 0.</span> +122: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span> +123: <span class="ruby-identifier">second</span> = <span class="ruby-identifier">second</span>.<span class="ruby-identifier">to_i</span> +124: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">second</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">second</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> +125: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Second #{second} out of range (0 - 59)&quot;</span> +126: <span class="ruby-keyword kw">end</span> +127: <span class="ruby-keyword kw">else</span> +128: <span class="ruby-identifier">second</span> = <span class="ruby-value">0</span> +129: <span class="ruby-keyword kw">end</span> +130: <span class="ruby-keyword kw">else</span> +131: <span class="ruby-identifier">hour</span> = <span class="ruby-identifier">minute</span> = <span class="ruby-identifier">second</span> = <span class="ruby-value">0</span> +132: <span class="ruby-keyword kw">end</span> +133: +134: <span class="ruby-comment cmt"># The zone is optional and defaults to the current time zone.</span> +135: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span> +136: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">--</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">++</span> +137: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment must be prefixed by &quot;</span> <span class="ruby-operator">+</span> +138: <span class="ruby-node">&quot;+ or -, not #{zone[0]}&quot;</span> +139: <span class="ruby-keyword kw">end</span> +140: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">zone</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-value">5</span> +141: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment must use (+/-)HHMM format&quot;</span> +142: <span class="ruby-keyword kw">end</span> +143: +144: <span class="ruby-identifier">date</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">utc</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span>) +145: <span class="ruby-identifier">sign</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">--</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">1</span> +146: <span class="ruby-identifier">tzHour</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span> +147: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tzHour</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tzHour</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +148: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment hour out of range &quot;</span> <span class="ruby-operator">+</span> +149: <span class="ruby-node">&quot;(0 - 12) but is #{tzHour}&quot;</span> +150: <span class="ruby-keyword kw">end</span> +151: <span class="ruby-identifier">tzMinute</span> = <span class="ruby-identifier">zone</span>[<span class="ruby-value">3</span><span class="ruby-operator">..</span><span class="ruby-value">4</span>].<span class="ruby-identifier">to_i</span> +152: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tzMinute</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">tzMinute</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">59</span> +153: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">&quot;Time zone adjustment minute out of range &quot;</span> <span class="ruby-operator">+</span> +154: <span class="ruby-node">&quot;(0 - 59) but is #{tzMinute}&quot;</span> +155: <span class="ruby-keyword kw">end</span> +156: <span class="ruby-identifier">date</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sign</span> * (<span class="ruby-identifier">tzHour</span> * <span class="ruby-value">3600</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">tzMinute</span> * <span class="ruby-value">60</span>) +157: <span class="ruby-keyword kw">else</span> +158: <span class="ruby-identifier">date</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">minute</span>, <span class="ruby-identifier">second</span>) +159: <span class="ruby-keyword kw">end</span> +160: +161: <span class="ruby-comment cmt">#puts &quot;--&gt; #{t}&quot;</span> +162: <span class="ruby-comment cmt">#puts(&quot;&gt;&gt;&gt; #{year}-#{month}-#{day}-#{hour}:#{minute}:#{second}&quot; +</span> +163: <span class="ruby-comment cmt"># &quot;#{zone ? &quot;-#{tzHour}:#{tzMinute}&quot; : &quot;&quot;}&quot;)</span> +164: <span class="ruby-comment cmt">#puts &quot;=== #{date}&quot;</span> +165: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">date</span>) +166: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1086,14 +1092,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 223</span> -223: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">%</span>(<span class="ruby-identifier">val</span>) -224: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">val</span> -225: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 224</span> +224: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">%</span>(<span class="ruby-identifier">val</span>) +225: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">val</span> +226: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1122,14 +1128,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 208</span> -208: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">secs</span>) -209: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">secs</span>) -210: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 209</span> +209: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">secs</span>) +210: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">secs</span>) +211: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1159,18 +1165,18 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 214</span> -214: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">arg</span>) -215: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">TjTime</span>) -216: <span class="ruby-ivar">@time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">time</span> -217: <span class="ruby-keyword kw">else</span> -218: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">arg</span>) -219: <span class="ruby-keyword kw">end</span> -220: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 215</span> +215: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">arg</span>) +216: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">TjTime</span>) +217: <span class="ruby-ivar">@time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">time</span> +218: <span class="ruby-keyword kw">else</span> +219: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">arg</span>) +220: <span class="ruby-keyword kw">end</span> +221: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1199,14 +1205,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 228</span> -228: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;</span>(<span class="ruby-identifier">t</span>) -229: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -230: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 229</span> +229: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;</span>(<span class="ruby-identifier">t</span>) +230: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +231: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1235,14 +1241,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 233</span> -233: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=</span>(<span class="ruby-identifier">t</span>) -234: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -235: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 234</span> +234: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=</span>(<span class="ruby-identifier">t</span>) +235: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +236: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1271,14 +1277,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 254</span> -254: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">t</span>) -255: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -256: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 255</span> +255: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">t</span>) +256: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +257: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1307,15 +1313,15 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 248</span> -248: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">t</span>) -249: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">nil?</span> -250: <span class="ruby-ivar">@time</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -251: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 249</span> +249: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">t</span>) +250: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">nil?</span> +251: <span class="ruby-ivar">@time</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +252: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1344,14 +1350,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 238</span> -238: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&gt;</span>(<span class="ruby-identifier">t</span>) -239: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -240: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 239</span> +239: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&gt;</span>(<span class="ruby-identifier">t</span>) +240: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +241: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1380,14 +1386,14 @@ <div class="method-source-code" id="--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 243</span> -243: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&gt;=</span>(<span class="ruby-identifier">t</span>) -244: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> -245: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 244</span> +244: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&gt;=</span>(<span class="ruby-identifier">t</span>) +245: <span class="ruby-ivar">@time</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">time</span> +246: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1417,14 +1423,14 @@ <div class="method-source-code" id="align-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 196</span> -196: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align</span>(<span class="ruby-identifier">clock</span>) -197: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>((<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">clock</span>) * <span class="ruby-identifier">clock</span>) -198: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 197</span> +197: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align</span>(<span class="ruby-identifier">clock</span>) +198: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>((<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">clock</span>) * <span class="ruby-identifier">clock</span>) +199: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1453,18 +1459,18 @@ <div class="method-source-code" id="begin-f-our-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 269</span> -269: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfHour</span> -270: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -271: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">2</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2</span>, <span class="ruby-value">0</span>) -272: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -273: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -274: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) -275: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 270</span> +270: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfHour</span> +271: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +272: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">2</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2</span>, <span class="ruby-value">0</span>) +273: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +274: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +275: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) +276: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1493,19 +1499,19 @@ <div class="method-source-code" id="begin-f-onth-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 302</span> -302: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfMonth</span> -303: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -304: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">0</span>) -305: <span class="ruby-identifier">t</span>[<span class="ruby-value">3</span>] = <span class="ruby-value">1</span> -306: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -307: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -308: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) -309: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 303</span> +303: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfMonth</span> +304: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +305: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">0</span>) +306: <span class="ruby-identifier">t</span>[<span class="ruby-value">3</span>] = <span class="ruby-value">1</span> +307: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +308: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +309: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) +310: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1534,20 +1540,20 @@ <div class="method-source-code" id="begin-f-uarter-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 312</span> -312: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfQuarter</span> -313: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -314: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">0</span>) -315: <span class="ruby-identifier">t</span>[<span class="ruby-value">3</span>] = <span class="ruby-value">1</span> -316: <span class="ruby-identifier">t</span>[<span class="ruby-value">4</span>] = ((<span class="ruby-identifier">t</span>[<span class="ruby-value">4</span>] <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">%</span> <span class="ruby-value">3</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span> -317: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -318: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -319: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) -320: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 313</span> +313: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfQuarter</span> +314: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +315: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">0</span>) +316: <span class="ruby-identifier">t</span>[<span class="ruby-value">3</span>] = <span class="ruby-value">1</span> +317: <span class="ruby-identifier">t</span>[<span class="ruby-value">4</span>] = ((<span class="ruby-identifier">t</span>[<span class="ruby-value">4</span>] <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">%</span> <span class="ruby-value">3</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span> +318: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +319: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +320: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) +321: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1577,23 +1583,23 @@ <div class="method-source-code" id="begin-f-eek-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 288</span> -288: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfWeek</span>(<span class="ruby-identifier">startMonday</span>) -289: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_a</span> -290: <span class="ruby-comment cmt"># Set time to noon, 12:00:00</span> -291: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = [ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">12</span> ] -292: <span class="ruby-identifier">weekday</span> = <span class="ruby-identifier">t</span>[<span class="ruby-value">6</span>] -293: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -294: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -295: <span class="ruby-comment cmt"># Substract the number of days determined by the weekday t[6] and set time</span> -296: <span class="ruby-comment cmt"># to midnight of that day.</span> -297: (<span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) <span class="ruby-operator">-</span> -298: (<span class="ruby-identifier">weekday</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">startMonday</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)) * <span class="ruby-value">60</span> * <span class="ruby-value">60</span> * <span class="ruby-value">24</span>).<span class="ruby-identifier">midnight</span> -299: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 289</span> +289: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfWeek</span>(<span class="ruby-identifier">startMonday</span>) +290: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_a</span> +291: <span class="ruby-comment cmt"># Set time to noon, 12:00:00</span> +292: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = [ <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-value">12</span> ] +293: <span class="ruby-identifier">weekday</span> = <span class="ruby-identifier">t</span>[<span class="ruby-value">6</span>] +294: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +295: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +296: <span class="ruby-comment cmt"># Substract the number of days determined by the weekday t[6] and set time</span> +297: <span class="ruby-comment cmt"># to midnight of that day.</span> +298: (<span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) <span class="ruby-operator">-</span> +299: (<span class="ruby-identifier">weekday</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">startMonday</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)) * <span class="ruby-value">60</span> * <span class="ruby-value">60</span> * <span class="ruby-value">24</span>).<span class="ruby-identifier">midnight</span> +300: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1622,19 +1628,19 @@ <div class="method-source-code" id="begin-f-ear-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 323</span> -323: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfYear</span> -324: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -325: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">0</span>) -326: <span class="ruby-identifier">t</span>[<span class="ruby-value">3</span>, <span class="ruby-value">2</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2</span>, <span class="ruby-value">1</span>) -327: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -328: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -329: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) -330: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 324</span> +324: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">beginOfYear</span> +325: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +326: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">0</span>) +327: <span class="ruby-identifier">t</span>[<span class="ruby-value">3</span>, <span class="ruby-value">2</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2</span>, <span class="ruby-value">1</span>) +328: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +329: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +330: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) +331: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1664,14 +1670,14 @@ <div class="method-source-code" id="days-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 414</span> -414: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">daysTo</span>(<span class="ruby-identifier">date</span>) -415: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextDay</span>) -416: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 415</span> +415: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">daysTo</span>(<span class="ruby-identifier">date</span>) +416: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextDay</span>) +417: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1700,14 +1706,14 @@ <div class="method-source-code" id="hours-ater-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 333</span> -333: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hoursLater</span>(<span class="ruby-identifier">hours</span>) -334: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">hours</span> * <span class="ruby-value">3600</span>) -335: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 334</span> +334: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hoursLater</span>(<span class="ruby-identifier">hours</span>) +335: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">hours</span> * <span class="ruby-value">3600</span>) +336: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1737,15 +1743,15 @@ <div class="method-source-code" id="hours-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 407</span> -407: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hoursTo</span>(<span class="ruby-identifier">date</span>) -408: <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) -409: ((<span class="ruby-identifier">t2</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t1</span>) <span class="ruby-operator">/</span> <span class="ruby-value">3600</span>).<span class="ruby-identifier">ceil</span> -410: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 408</span> +408: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hoursTo</span>(<span class="ruby-identifier">date</span>) +409: <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) +410: ((<span class="ruby-identifier">t2</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t1</span>) <span class="ruby-operator">/</span> <span class="ruby-value">3600</span>).<span class="ruby-identifier">ceil</span> +411: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1774,14 +1780,14 @@ <div class="method-source-code" id="method-missing-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 503</span> -503: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">func</span>, *<span class="ruby-identifier">args</span>) -504: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">func</span>).<span class="ruby-identifier">call</span>(*<span class="ruby-identifier">args</span>) -505: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 504</span> +504: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">func</span>, *<span class="ruby-identifier">args</span>) +505: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">method</span>(<span class="ruby-identifier">func</span>).<span class="ruby-identifier">call</span>(*<span class="ruby-identifier">args</span>) +506: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1810,18 +1816,18 @@ <div class="method-source-code" id="midnight-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 278</span> -278: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">midnight</span> -279: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -280: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">0</span>) -281: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -282: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -283: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) -284: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 279</span> +279: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">midnight</span> +280: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +281: <span class="ruby-identifier">t</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">0</span>) +282: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +283: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +284: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) +285: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1851,14 +1857,14 @@ <div class="method-source-code" id="month-nd-ear-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 480</span> -480: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monthAndYear</span> -481: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%b %Y'</span>) -482: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 481</span> +481: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monthAndYear</span> +482: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%b %Y'</span>) +483: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1888,14 +1894,14 @@ <div class="method-source-code" id="months-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 426</span> -426: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monthsTo</span>(<span class="ruby-identifier">date</span>) -427: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextMonth</span>) -428: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 427</span> +427: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">monthsTo</span>(<span class="ruby-identifier">date</span>) +428: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextMonth</span>) +429: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1928,18 +1934,18 @@ <div class="method-source-code" id="next-ay-f-eek-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 494</span> -494: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nextDayOfWeek</span>(<span class="ruby-identifier">dow</span>) -495: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Day of week must be 0 - 6.&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">dow</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">dow</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">6</span> -496: <span class="ruby-identifier">d</span> = <span class="ruby-identifier">midnight</span>.<span class="ruby-identifier">sameTimeNextDay</span> -497: <span class="ruby-identifier">currentDoW</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%w'</span>).<span class="ruby-identifier">to_i</span> -498: <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>((<span class="ruby-identifier">dow</span> <span class="ruby-operator">+</span> <span class="ruby-value">7</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">currentDoW</span>) <span class="ruby-operator">%</span> <span class="ruby-value">7</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">sameTimeNextDay</span> } -499: <span class="ruby-identifier">d</span> -500: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 495</span> +495: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nextDayOfWeek</span>(<span class="ruby-identifier">dow</span>) +496: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Day of week must be 0 - 6.&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">dow</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">dow</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">6</span> +497: <span class="ruby-identifier">d</span> = <span class="ruby-identifier">midnight</span>.<span class="ruby-identifier">sameTimeNextDay</span> +498: <span class="ruby-identifier">currentDoW</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%w'</span>).<span class="ruby-identifier">to_i</span> +499: <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>((<span class="ruby-identifier">dow</span> <span class="ruby-operator">+</span> <span class="ruby-value">7</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">currentDoW</span>) <span class="ruby-operator">%</span> <span class="ruby-value">7</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span>.<span class="ruby-identifier">sameTimeNextDay</span> } +500: <span class="ruby-identifier">d</span> +501: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1968,14 +1974,14 @@ <div class="method-source-code" id="quarter-ame-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 469</span> -469: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quarterName</span> -470: <span class="ruby-node">&quot;Q#{(@time.mon / 3) + 1}&quot;</span> -471: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 470</span> +470: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quarterName</span> +471: <span class="ruby-node">&quot;Q#{(@time.mon / 3) + 1}&quot;</span> +472: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2005,14 +2011,14 @@ <div class="method-source-code" id="quarters-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 432</span> -432: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quartersTo</span>(<span class="ruby-identifier">date</span>) -433: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextQuarter</span>) -434: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 433</span> +433: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quartersTo</span>(<span class="ruby-identifier">date</span>) +434: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextQuarter</span>) +435: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2042,21 +2048,21 @@ <div class="method-source-code" id="same-ime-ext-ay-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 344</span> -344: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextDay</span> -345: <span class="ruby-identifier">delta</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span> ] -346: <span class="ruby-identifier">localT1</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -347: <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> -348: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> (<span class="ruby-value">24</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">d</span>) * <span class="ruby-value">60</span> * <span class="ruby-value">60</span> -349: <span class="ruby-identifier">localT2</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -350: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">t</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">localT1</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">localT2</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] -351: <span class="ruby-keyword kw">end</span> -352: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Algorithm is broken for #{@time}&quot;</span> -353: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 345</span> +345: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextDay</span> +346: <span class="ruby-identifier">delta</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span> ] +347: <span class="ruby-identifier">localT1</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +348: <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> +349: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> (<span class="ruby-value">24</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">d</span>) * <span class="ruby-value">60</span> * <span class="ruby-value">60</span> +350: <span class="ruby-identifier">localT2</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +351: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">t</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">localT1</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">localT2</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] +352: <span class="ruby-keyword kw">end</span> +353: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Algorithm is broken for #{@time}&quot;</span> +354: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2085,14 +2091,14 @@ <div class="method-source-code" id="same-ime-ext-our-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 338</span> -338: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextHour</span> -339: <span class="ruby-identifier">hoursLater</span>(<span class="ruby-value">1</span>) -340: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 339</span> +339: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextHour</span> +340: <span class="ruby-identifier">hoursLater</span>(<span class="ruby-value">1</span>) +341: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2122,22 +2128,22 @@ <div class="method-source-code" id="same-ime-ext-onth-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 370</span> -370: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextMonth</span> -371: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -372: <span class="ruby-identifier">monMax</span> = <span class="ruby-identifier">month</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-constant">MON_MAX</span>[<span class="ruby-identifier">month</span>] -373: <span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -374: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -375: <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> -376: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -377: <span class="ruby-keyword kw">end</span> -378: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">monMax</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">day</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">monMax</span> -379: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span>)) -380: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 371</span> +371: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextMonth</span> +372: <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">year</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +373: <span class="ruby-identifier">monMax</span> = <span class="ruby-identifier">month</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) <span class="ruby-operator">?</span> <span class="ruby-value">29</span> <span class="ruby-operator">:</span> <span class="ruby-constant">MON_MAX</span>[<span class="ruby-identifier">month</span>] +374: <span class="ruby-identifier">month</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +375: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">month</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +376: <span class="ruby-identifier">month</span> = <span class="ruby-value">1</span> +377: <span class="ruby-identifier">year</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +378: <span class="ruby-keyword kw">end</span> +379: <span class="ruby-identifier">day</span> = <span class="ruby-identifier">monMax</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">day</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">monMax</span> +380: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-value">0</span>)) +381: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2167,21 +2173,21 @@ <div class="method-source-code" id="same-ime-ext-uarter-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 384</span> -384: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextQuarter</span> -385: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -386: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">t</span>[<span class="ruby-value">4</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">3</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> -387: <span class="ruby-identifier">t</span>[<span class="ruby-value">4</span>] <span class="ruby-operator">-=</span> <span class="ruby-value">12</span> -388: <span class="ruby-identifier">t</span>[<span class="ruby-value">5</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -389: <span class="ruby-keyword kw">end</span> -390: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -391: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -392: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) -393: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 385</span> +385: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextQuarter</span> +386: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +387: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">t</span>[<span class="ruby-value">4</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">3</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">12</span> +388: <span class="ruby-identifier">t</span>[<span class="ruby-value">4</span>] <span class="ruby-operator">-=</span> <span class="ruby-value">12</span> +389: <span class="ruby-identifier">t</span>[<span class="ruby-value">5</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +390: <span class="ruby-keyword kw">end</span> +391: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +392: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +393: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) +394: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2211,21 +2217,21 @@ <div class="method-source-code" id="same-ime-ext-eek-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 357</span> -357: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextWeek</span> -358: <span class="ruby-identifier">delta</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span> ] -359: <span class="ruby-identifier">localT1</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -360: <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> -361: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> (<span class="ruby-value">7</span> * <span class="ruby-value">24</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">d</span>) * <span class="ruby-value">60</span> * <span class="ruby-value">60</span> -362: <span class="ruby-identifier">localT2</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -363: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">t</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">localT1</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">localT2</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] -364: <span class="ruby-keyword kw">end</span> -365: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Algorithm is broken for #{@time}&quot;</span> -366: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 358</span> +358: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextWeek</span> +359: <span class="ruby-identifier">delta</span> = [ <span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span> ] +360: <span class="ruby-identifier">localT1</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +361: <span class="ruby-identifier">delta</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> +362: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span> <span class="ruby-operator">+</span> (<span class="ruby-value">7</span> * <span class="ruby-value">24</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">d</span>) * <span class="ruby-value">60</span> * <span class="ruby-value">60</span> +363: <span class="ruby-identifier">localT2</span> = <span class="ruby-identifier">t</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +364: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">t</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">localT1</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">localT2</span>[<span class="ruby-value">0</span>, <span class="ruby-value">3</span>] +365: <span class="ruby-keyword kw">end</span> +366: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Algorithm is broken for #{@time}&quot;</span> +367: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2255,18 +2261,18 @@ <div class="method-source-code" id="same-ime-ext-ear-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 397</span> -397: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextYear</span> -398: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> -399: <span class="ruby-identifier">t</span>[<span class="ruby-value">5</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -400: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) -401: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> -402: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) -403: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 398</span> +398: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sameTimeNextYear</span> +399: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">to_a</span> +400: <span class="ruby-identifier">t</span>[<span class="ruby-value">5</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +401: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">6</span>, <span class="ruby-value">4</span>) +402: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">reverse!</span> +403: <span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">local</span>(*<span class="ruby-identifier">t</span>)) +404: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2296,15 +2302,15 @@ <div class="method-source-code" id="seconds-f-ay-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 202</span> -202: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">secondsOfDay</span>(<span class="ruby-identifier">tz</span> = <span class="ruby-keyword kw">nil</span>) -203: <span class="ruby-comment cmt"># TODO: Add timezone support</span> -204: (<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">gmt_offset</span>) <span class="ruby-operator">%</span> (<span class="ruby-value">60</span> * <span class="ruby-value">60</span> * <span class="ruby-value">24</span>) -205: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 203</span> +203: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">secondsOfDay</span>(<span class="ruby-identifier">tz</span> = <span class="ruby-keyword kw">nil</span>) +204: <span class="ruby-comment cmt"># TODO: Add timezone support</span> +205: (<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">gmt_offset</span>) <span class="ruby-operator">%</span> (<span class="ruby-value">60</span> * <span class="ruby-value">60</span> * <span class="ruby-value">24</span>) +206: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2333,14 +2339,14 @@ <div class="method-source-code" id="short-onth-ame-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 464</span> -464: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shortMonthName</span> -465: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%b'</span>) -466: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 465</span> +465: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shortMonthName</span> +466: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%b'</span>) +467: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2367,14 +2373,14 @@ <div class="method-source-code" id="to-ary-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 458</span> -458: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ary</span> -459: <span class="ruby-identifier">to_s</span> -460: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 459</span> +459: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ary</span> +460: <span class="ruby-identifier">to_s</span> +461: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2403,14 +2409,14 @@ <div class="method-source-code" id="to-i-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 454</span> -454: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_i</span> -455: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> -456: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 455</span> +455: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_i</span> +456: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">to_i</span> +457: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2440,19 +2446,19 @@ <div class="method-source-code" id="to-s-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 444</span> -444: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-keyword kw">nil</span>) -445: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'unknown'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">nil?</span> -446: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span>.<span class="ruby-identifier">nil?</span> -447: <span class="ruby-identifier">format</span> = <span class="ruby-value str">'%Y-%m-%d-%H:%M'</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">sec</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value str">''</span> <span class="ruby-operator">:</span> <span class="ruby-value str">':%S'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'-%z'</span> -448: <span class="ruby-keyword kw">end</span> -449: <span class="ruby-comment cmt"># Always report values in local timezone</span> -450: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>) -451: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 445</span> +445: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-keyword kw">nil</span>) +446: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">'unknown'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">nil?</span> +447: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">format</span>.<span class="ruby-identifier">nil?</span> +448: <span class="ruby-identifier">format</span> = <span class="ruby-value str">'%Y-%m-%d-%H:%M'</span> <span class="ruby-operator">+</span> (<span class="ruby-ivar">@time</span>.<span class="ruby-identifier">sec</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value str">''</span> <span class="ruby-operator">:</span> <span class="ruby-value str">':%S'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'-%z'</span> +449: <span class="ruby-keyword kw">end</span> +450: <span class="ruby-comment cmt"># Always report values in local timezone</span> +451: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">localtime</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">format</span>) +452: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2482,18 +2488,18 @@ <div class="method-source-code" id="upto-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 260</span> -260: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upto</span>(<span class="ruby-identifier">endDate</span>, <span class="ruby-identifier">step</span> = <span class="ruby-value">1</span>) -261: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span> -262: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">endDate</span>.<span class="ruby-identifier">time</span> -263: <span class="ruby-keyword kw">yield</span>(<span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">t</span>)) -264: <span class="ruby-identifier">t</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">step</span> -265: <span class="ruby-keyword kw">end</span> -266: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 261</span> +261: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upto</span>(<span class="ruby-identifier">endDate</span>, <span class="ruby-identifier">step</span> = <span class="ruby-value">1</span>) +262: <span class="ruby-identifier">t</span> = <span class="ruby-ivar">@time</span> +263: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">endDate</span>.<span class="ruby-identifier">time</span> +264: <span class="ruby-keyword kw">yield</span>(<span class="ruby-constant">TjTime</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">t</span>)) +265: <span class="ruby-identifier">t</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">step</span> +266: <span class="ruby-keyword kw">end</span> +267: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2523,14 +2529,14 @@ <div class="method-source-code" id="week-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 475</span> -475: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">week</span>(<span class="ruby-identifier">weekStartsMonday</span>) -476: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">weekStartsMonday</span> <span class="ruby-operator">?</span> <span class="ruby-value str">'%W'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'%U'</span>) -477: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 476</span> +476: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">week</span>(<span class="ruby-identifier">weekStartsMonday</span>) +477: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">weekStartsMonday</span> <span class="ruby-operator">?</span> <span class="ruby-value str">'%W'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'%U'</span>) +478: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2560,14 +2566,14 @@ <div class="method-source-code" id="weekday-nd-ate-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 485</span> -485: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weekdayAndDate</span> -486: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%A %Y-%m-%d'</span>) -487: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 486</span> +486: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weekdayAndDate</span> +487: <span class="ruby-ivar">@time</span>.<span class="ruby-identifier">strftime</span>(<span class="ruby-value str">'%A %Y-%m-%d'</span>) +488: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2597,14 +2603,14 @@ <div class="method-source-code" id="weeks-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 420</span> -420: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weeksTo</span>(<span class="ruby-identifier">date</span>) -421: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextWeek</span>) -422: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 421</span> +421: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">weeksTo</span>(<span class="ruby-identifier">date</span>) +422: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextWeek</span>) +423: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2634,14 +2640,14 @@ <div class="method-source-code" id="years-o-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 438</span> -438: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">yearsTo</span>(<span class="ruby-identifier">date</span>) -439: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextYear</span>) -440: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 439</span> +439: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">yearsTo</span>(<span class="ruby-identifier">date</span>) +440: <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-value">:sameTimeNextYear</span>) +441: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2674,20 +2680,20 @@ <div class="method-source-code" id="count-ntervals-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 520</span> -520: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">stepFunc</span>) -521: <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span> -522: <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) -523: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">t1</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">t2</span> -524: <span class="ruby-identifier">t1</span> = <span class="ruby-identifier">t1</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">stepFunc</span>) -525: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -526: <span class="ruby-keyword kw">end</span> -527: <span class="ruby-identifier">i</span> -528: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 521</span> +521: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">countIntervals</span>(<span class="ruby-identifier">date</span>, <span class="ruby-identifier">stepFunc</span>) +522: <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span> +523: <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) +524: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">t1</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">t2</span> +525: <span class="ruby-identifier">t1</span> = <span class="ruby-identifier">t1</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">stepFunc</span>) +526: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +527: <span class="ruby-keyword kw">end</span> +528: <span class="ruby-identifier">i</span> +529: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2714,21 +2720,21 @@ <div class="method-source-code" id="leap-ear--source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 530</span> -530: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) -531: <span class="ruby-keyword kw">case</span> -532: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">400</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> -533: <span class="ruby-keyword kw">true</span> -534: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">100</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> -535: <span class="ruby-keyword kw">false</span> -536: <span class="ruby-keyword kw">else</span> -537: <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">4</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> -538: <span class="ruby-keyword kw">end</span> -539: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 531</span> +531: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">leapYear?</span>(<span class="ruby-identifier">year</span>) +532: <span class="ruby-keyword kw">case</span> +533: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">400</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> +534: <span class="ruby-keyword kw">true</span> +535: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">100</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> +536: <span class="ruby-keyword kw">false</span> +537: <span class="ruby-keyword kw">else</span> +538: <span class="ruby-identifier">year</span> <span class="ruby-operator">%</span> <span class="ruby-value">4</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> +539: <span class="ruby-keyword kw">end</span> +540: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -2755,20 +2761,20 @@ <div class="method-source-code" id="order-source"> <pre> - <span class="ruby-comment cmt"># File lib/TjTime.rb, line 509</span> -509: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) -510: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">date</span>.<span class="ruby-identifier">time</span> <span class="ruby-operator">&lt;</span> <span class="ruby-ivar">@time</span> -511: <span class="ruby-identifier">t1</span> = <span class="ruby-identifier">date</span> -512: <span class="ruby-identifier">t2</span> = <span class="ruby-keyword kw">self</span> -513: <span class="ruby-keyword kw">else</span> -514: <span class="ruby-identifier">t1</span> = <span class="ruby-keyword kw">self</span> -515: <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">date</span> -516: <span class="ruby-keyword kw">end</span> -517: [ <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> ] -518: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TjTime.rb, line 510</span> +510: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">order</span>(<span class="ruby-identifier">date</span>) +511: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">date</span>.<span class="ruby-identifier">time</span> <span class="ruby-operator">&lt;</span> <span class="ruby-ivar">@time</span> +512: <span class="ruby-identifier">t1</span> = <span class="ruby-identifier">date</span> +513: <span class="ruby-identifier">t2</span> = <span class="ruby-keyword kw">self</span> +514: <span class="ruby-keyword kw">else</span> +515: <span class="ruby-identifier">t1</span> = <span class="ruby-keyword kw">self</span> +516: <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">date</span> +517: <span class="ruby-keyword kw">end</span> +518: [ <span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t2</span> ] +519: <span class="ruby-keyword kw">end</span></pre> </div> </div>