doc/Lazier/DateTime/ClassMethods.html in lazier-3.5.1 vs doc/Lazier/DateTime/ClassMethods.html in lazier-3.5.2

- old
+ new

@@ -4,22 +4,22 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Module: Lazier::DateTime::ClassMethods - &mdash; Documentation by YARD 0.8.7.3 + &mdash; Documentation by YARD 0.8.7.4 </title> <link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" /> <script type="text/javascript" charset="utf-8"> hasFrames = window.top.frames.main ? true : false; relpath = '../../'; - framesUrl = "../../frames.html#!" + escape(window.location.href); + framesUrl = "../../frames.html#!Lazier/DateTime/ClassMethods.html"; </script> <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script> @@ -202,11 +202,11 @@ <li class="public "> <span class="summary_signature"> - <a href="#is_valid%3F-instance_method" title="#is_valid? (instance method)">- (Boolean) <strong>is_valid?</strong>(value, format = &quot;%F %T&quot;) </a> + <a href="#list_timezones-instance_method" title="#list_timezones (instance method)">- (Array) <strong>list_timezones</strong>(with_dst = true, dst_label = nil) </a> </span> @@ -216,20 +216,20 @@ - <span class="summary_desc"><div class='inline'><p>Checks if the date is valid against to a specific format.</p> + <span class="summary_desc"><div class='inline'><p>Returns a list of names of all timezones.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> - <a href="#list_timezones-instance_method" title="#list_timezones (instance method)">- (Array) <strong>list_timezones</strong>(with_dst = true, dst_label = nil) </a> + <a href="#months-instance_method" title="#months (instance method)">- (Array) <strong>months</strong>(short = true) </a> </span> @@ -239,20 +239,20 @@ - <span class="summary_desc"><div class='inline'><p>Returns a list of names of all timezones.</p> + <span class="summary_desc"><div class='inline'><p>Returns strings representations of months.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> - <a href="#months-instance_method" title="#months (instance method)">- (Array) <strong>months</strong>(short = true) </a> + <a href="#parameterize_zone-instance_method" title="#parameterize_zone (instance method)">- (String) <strong>parameterize_zone</strong>(tz, with_offset = true) </a> </span> @@ -262,20 +262,20 @@ - <span class="summary_desc"><div class='inline'><p>Returns strings representations of months.</p> + <span class="summary_desc"><div class='inline'><p>Returns a string representation of a timezone.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> - <a href="#parameterize_zone-instance_method" title="#parameterize_zone (instance method)">- (String) <strong>parameterize_zone</strong>(tz, with_offset = true) </a> + <a href="#rationalize_offset-instance_method" title="#rationalize_offset (instance method)">- (Rational) <strong>rationalize_offset</strong>(offset) </a> </span> @@ -285,20 +285,20 @@ - <span class="summary_desc"><div class='inline'><p>Returns a string representation of a timezone.</p> + <span class="summary_desc"><div class='inline'><p>Returns an offset in rational value.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> - <a href="#rationalize_offset-instance_method" title="#rationalize_offset (instance method)">- (Rational) <strong>rationalize_offset</strong>(offset) </a> + <a href="#timezones-instance_method" title="#timezones (instance method)">- (Array) <strong>timezones</strong> </a> </span> @@ -308,20 +308,20 @@ - <span class="summary_desc"><div class='inline'><p>Returns an offset in rational value.</p> + <span class="summary_desc"><div class='inline'><p>Returns all the availabe timezones.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> - <a href="#timezones-instance_method" title="#timezones (instance method)">- (Array) <strong>timezones</strong> </a> + <a href="#unparameterize_zone-instance_method" title="#unparameterize_zone (instance method)">- (String|TimeZone) <strong>unparameterize_zone</strong>(tz, as_string = false, dst_label = nil) </a> </span> @@ -331,34 +331,36 @@ - <span class="summary_desc"><div class='inline'><p>Returns all the availabe timezones.</p> + <span class="summary_desc"><div class='inline'><p>Finds a parameterized timezone.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> - <a href="#unparameterize_zone-instance_method" title="#unparameterize_zone (instance method)">- (String|TimeZone) <strong>unparameterize_zone</strong>(tz, as_string = false, dst_label = nil) </a> + <a href="#valid%3F-instance_method" title="#valid? (instance method)">- (Boolean) <strong>valid?</strong>(value, format = &quot;%F %T&quot;) </a> + (also: #is_valid?) + </span> - <span class="summary_desc"><div class='inline'><p>Finds a parameterized timezone.</p> + <span class="summary_desc"><div class='inline'><p>Checks if the date is valid against to a specific format.</p> </div></span> </li> @@ -651,17 +653,17 @@ </td> <td> <pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 121</span> <span class='kw'>def</span> <span class='id identifier rubyid_easter'>easter</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span> - <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_today'>today</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_year'>year</span><span class='period'>.</span><span class='id identifier rubyid_is_integer?'>is_integer?</span> + <span class='id identifier rubyid_year'>year</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_today'>today</span><span class='period'>.</span><span class='id identifier rubyid_year'>year</span> <span class='kw'>unless</span> <span class='id identifier rubyid_year'>year</span><span class='period'>.</span><span class='id identifier rubyid_is_integer?'>is_integer?</span> <span class='comment'># Compute using Anonymous Gregorian Algorithm: http://en.wikipedia.org/wiki/Computus#Anonymous_Gregorian_algorithm </span> <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_easter_start'>easter_start</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='rparen'>)</span> - <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_easter_part_1'>easter_part_1</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> - <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_easter_part_2'>easter_part_2</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> - <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_easter_part_3'>easter_part_3</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> + <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_easter_divide'>easter_divide</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> + <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_easter_aggregate'>easter_aggregate</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> + <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_easter_prepare'>easter_prepare</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> <span class='id identifier rubyid_day'>day</span><span class='comma'>,</span> <span class='id identifier rubyid_month'>month</span> <span class='op'>=</span> <span class='id identifier rubyid_easter_end'>easter_end</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> <span class='op'>::</span><span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_civil'>civil</span><span class='lparen'>(</span><span class='id identifier rubyid_year'>year</span><span class='comma'>,</span> <span class='id identifier rubyid_month'>month</span><span class='comma'>,</span> <span class='id identifier rubyid_day'>day</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> @@ -763,110 +765,10 @@ </tr> </table> </div> <div class="method_details "> - <h3 class="signature " id="is_valid?-instance_method"> - - - (<tt><span class='object_link'><a href="../Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>is_valid?</strong>(value, format = &quot;%F %T&quot;) - - - - - -</h3><div class="docstring"> - <div class="discussion"> - <p>Checks if the date is valid against to a specific format.</p> - - - </div> -</div> -<div class="tags"> - <p class="tag_title">Parameters:</p> -<ul class="param"> - - <li> - - <span class='name'>value</span> - - - <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="Lazier::String (module)">String</a></span></tt>)</span> - - - - &mdash; - <div class='inline'><p>The value to check.</p> -</div> - - </li> - - <li> - - <span class='name'>format</span> - - - <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="Lazier::String (module)">String</a></span></tt>)</span> - - - <em class="default">(defaults to: <tt>&quot;%F %T&quot;</tt>)</em> - - - &mdash; - <div class='inline'><p>The format to check the value against.</p> -</div> - - </li> - -</ul> - -<p class="tag_title">Returns:</p> -<ul class="return"> - - <li> - - - <span class='type'>(<tt><span class='object_link'><a href="../Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span> - - - - &mdash; - <div class='inline'><p><code>true</code> if the value is valid against the format, <code>false</code> otherwise.</p> -</div> - - </li> - -</ul> - - <p class="tag_title">See Also:</p> - <ul class="see"> - - <li>DateTime#custom_format</li> - - </ul> - -</div><table class="source_code"> - <tr> - <td> - <pre class="lines"> - - -149 -150 -151</pre> - </td> - <td> - <pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 149</span> - -<span class='kw'>def</span> <span class='id identifier rubyid_is_valid?'>is_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%F %T</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> - <span class='op'>!</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_strptime'>strptime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_custom_format'>custom_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> -<span class='kw'>end</span></pre> - </td> - </tr> -</table> -</div> - - <div class="method_details "> <h3 class="signature " id="list_timezones-instance_method"> - (<tt>Array</tt>) <strong>list_timezones</strong>(with_dst = true, dst_label = nil) @@ -1137,11 +1039,11 @@ </td> <td> <pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 93</span> <span class='kw'>def</span> <span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span> - <span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='op'>::</span><span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span><span class='rparen'>)</span> + <span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='period'>.</span><span class='id identifier rubyid_parameterize_zone'>parameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_with_offset'>with_offset</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> @@ -1387,18 +1289,128 @@ </td> <td> <pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 104</span> <span class='kw'>def</span> <span class='id identifier rubyid_unparameterize_zone'>unparameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_as_string'>as_string</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span> - <span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='op'>::</span><span class='id identifier rubyid_unparameterize_zone'>unparameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_as_string'>as_string</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span><span class='rparen'>)</span> + <span class='op'>::</span><span class='const'>ActiveSupport</span><span class='op'>::</span><span class='const'>TimeZone</span><span class='period'>.</span><span class='id identifier rubyid_unparameterize_zone'>unparameterize_zone</span><span class='lparen'>(</span><span class='id identifier rubyid_tz'>tz</span><span class='comma'>,</span> <span class='id identifier rubyid_as_string'>as_string</span><span class='comma'>,</span> <span class='id identifier rubyid_dst_label'>dst_label</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> + <h3 class="signature " id="valid?-instance_method"> + + - (<tt><span class='object_link'><a href="../Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>valid?</strong>(value, format = &quot;%F %T&quot;) + + + + <span class="aliases">Also known as: + <span class="names"><span id='is_valid?-instance_method'>is_valid?</span></span> + </span> + + + +</h3><div class="docstring"> + <div class="discussion"> + <p>Checks if the date is valid against to a specific format.</p> + + + </div> +</div> +<div class="tags"> + <p class="tag_title">Parameters:</p> +<ul class="param"> + + <li> + + <span class='name'>value</span> + + + <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="Lazier::String (module)">String</a></span></tt>)</span> + + + + &mdash; + <div class='inline'><p>The value to check.</p> +</div> + + </li> + + <li> + + <span class='name'>format</span> + + + <span class='type'>(<tt><span class='object_link'><a href="../String.html" title="Lazier::String (module)">String</a></span></tt>)</span> + + + <em class="default">(defaults to: <tt>&quot;%F %T&quot;</tt>)</em> + + + &mdash; + <div class='inline'><p>The format to check the value against.</p> +</div> + + </li> + +</ul> + +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt><span class='object_link'><a href="../Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span> + + + + &mdash; + <div class='inline'><p><code>true</code> if the value is valid against the format, <code>false</code> otherwise.</p> +</div> + + </li> + +</ul> + + <p class="tag_title">See Also:</p> + <ul class="see"> + + <li>DateTime#custom_format</li> + + </ul> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +149 +150 +151 +152 +153 +154</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/lazier/datetime.rb', line 149</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%F %T</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> + <span class='op'>::</span><span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_strptime'>strptime</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_custom_format'>custom_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span><span class='rparen'>)</span> + <span class='kw'>true</span> +<span class='kw'>rescue</span> + <span class='kw'>false</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> <h3 class="signature " id="years-instance_method"> - (<tt>Array</tt>) <strong>years</strong>(offset = 10, also_future = true, reference = nil, as_objects = false) @@ -1540,12 +1552,12 @@ </div> </div> <div id="footer"> - Generated on Sun Feb 23 15:47:03 2014 by + Generated on Sun Apr 27 17:16:42 2014 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.8.7.3 (ruby-2.1.0). + 0.8.7.4 (ruby-2.1.0). </div> </body> </html> \ No newline at end of file