ShogunPanda/lazier

View on GitHub
docs/Lazier/Settings.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: Lazier::Settings
  
    &mdash; Documentation by YARD 0.9.5
  
</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">
  pathId = "Lazier::Settings";
  relpath = '../';
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../class_list.html"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../_index.html">Index (S)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Lazier.html" title="Lazier (module)">Lazier</a></span></span>
     &raquo; 
    <span class="title">Settings</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <iframe id="search_frame" src="../class_list.html"></iframe>

      <div id="content"><h1>Class: Lazier::Settings
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">Lazier::Settings</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/lazier/settings.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>Settings for the extensions.</p>


  </div>
</div>
<div class="tags">
  

</div>



  <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#boolean_names-instance_method" title="#boolean_names (instance method)">#<strong>boolean_names</strong>  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>String representations of booleans.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#date_formats-instance_method" title="#date_formats (instance method)">#<strong>date_formats</strong>  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Custom date and time formats.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#date_names-instance_method" title="#date_names (instance method)">#<strong>date_names</strong>  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>String representations of days and months.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#format_number-instance_method" title="#format_number (instance method)">#<strong>format_number</strong>  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Settings for numbers formatting.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#i18n-instance_method" title="#i18n (instance method)">#<strong>i18n</strong>  &#x21d2; R18n::Translation </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>The translation object.</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Class Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#instance-class_method" title="instance (class method)">.<strong>instance</strong>(force = false)  &#x21d2; Settings </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Returns the singleton instance of the settings.</p>
</div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>  &#x21d2; Settings </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Initializes a new settings object.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#setup-instance_method" title="#setup (instance method)">#<strong>setup</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Setups the current instance.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#setup_boolean_names-instance_method" title="#setup_boolean_names (instance method)">#<strong>setup_boolean_names</strong>(true_name: nil, false_name: nil)  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Setups strings representation of booleans.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#setup_date_formats-instance_method" title="#setup_date_formats (instance method)">#<strong>setup_date_formats</strong>(formats = nil, replace = false)  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Setups custom formats for dates and times.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#setup_date_names-instance_method" title="#setup_date_names (instance method)">#<strong>setup_date_names</strong>(long_months: nil, short_months: nil, long_days: nil, short_days: nil)  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Setups strings representation of days and months.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#setup_format_number-instance_method" title="#setup_format_number (instance method)">#<strong>setup_format_number</strong>(precision: 2, decimal_separator: &quot;.&quot;, add_string: nil, k_separator: &quot;,&quot;)  &#x21d2; Hash </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Setups formatters for a number.</p>
</div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    #<strong>initialize</strong>  &#x21d2; <tt><span class='object_link'><a href="" title="Lazier::Settings (class)">Settings</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Initializes a new settings object.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


32
33
34
35
36</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 32</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
  <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_load_datetime'>load_datetime</span>
  <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
  <span class='id identifier rubyid_setup'>setup</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="boolean_names-instance_method">
  
    #<strong>boolean_names</strong>  &#x21d2; <tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns String representations of booleans.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>String representations of booleans.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>

<span class='kw'>class</span> <span class='const'>Settings</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>

  <span class='comment'># Returns the singleton instance of the settings.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param force [Boolean] Whether to force recreation of the instance.
</span>  <span class='comment'># @return [Settings] The singleton instance of the settings.
</span>  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@instance</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_force'>force</span>
    <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
  <span class='kw'>end</span>

  <span class='comment'># Initializes a new settings object.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
    <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_load_datetime'>load_datetime</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
    <span class='id identifier rubyid_setup'>setup</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the current instance.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
    <span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
    <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
    <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
    <span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups formatters for a number.
</span>  <span class='comment'># @see Object#format_number
</span>  <span class='comment'>#
</span>  <span class='comment'># @param precision [Fixnum] The precision to show.
</span>  <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
</span>  <span class='comment'># @param add_string [String] The string to append to the number.
</span>  <span class='comment'># @param k_separator [String] The string to use as thousands separator.
</span>  <span class='comment'># @return [Hash] The new formatters.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
      <span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of booleans.
</span>  <span class='comment'># @see Object#format_boolean
</span>  <span class='comment'>#
</span>  <span class='comment'># @param true_name [String|NilClass] The string representation of `true`. Defaults to `Yes`.
</span>  <span class='comment'># @param false_name [String|NilClass] The string representation of `false`. Defaults to `No`.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>boolean</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups custom formats for dates and times.
</span>  <span class='comment'># @see DateTime#lstrftime
</span>  <span class='comment'>#
</span>  <span class='comment'># @param formats [Hash|NilClass] The format to add or replace.
</span>  <span class='comment'># @param replace [Boolean] Whether to discard current formats.
</span>  <span class='comment'># @return [Hash] The new formats.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>

    <span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>ct_date:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%Y-%m-%d</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_time:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_date_time:</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='comma'>,</span> <span class='label'>ct_iso_8601:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%FT%T%z</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span><span class='rparen'>)</span>
    <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>

    <span class='ivar'>@date_formats</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of days and months.
</span>  <span class='comment'># @see DateTime::ClassMethods#days
</span>  <span class='comment'># @see DateTime::ClassMethods#months
</span>  <span class='comment'># @see Lazier::DateTime#format
</span>  <span class='comment'>#
</span>  <span class='comment'># @param long_months [Array|NilClass] The string representation of months.
</span>  <span class='comment'># @param short_months [Array|NilClass] The abbreviated string representation of months.
</span>  <span class='comment'># @param long_days [Array|NilClass] The string representation of days.
</span>  <span class='comment'># @param short_days [Array|NilClass] The abbreviated string representation of days.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>

    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
      <span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
    <span class='rbrace'>}</span>

    <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='comma'>,</span> <span class='symbol'>:indifferent</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="date_formats-instance_method">
  
    #<strong>date_formats</strong>  &#x21d2; <tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns Custom date and time formats.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>Custom date and time formats.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>

<span class='kw'>class</span> <span class='const'>Settings</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>

  <span class='comment'># Returns the singleton instance of the settings.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param force [Boolean] Whether to force recreation of the instance.
</span>  <span class='comment'># @return [Settings] The singleton instance of the settings.
</span>  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@instance</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_force'>force</span>
    <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
  <span class='kw'>end</span>

  <span class='comment'># Initializes a new settings object.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
    <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_load_datetime'>load_datetime</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
    <span class='id identifier rubyid_setup'>setup</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the current instance.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
    <span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
    <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
    <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
    <span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups formatters for a number.
</span>  <span class='comment'># @see Object#format_number
</span>  <span class='comment'>#
</span>  <span class='comment'># @param precision [Fixnum] The precision to show.
</span>  <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
</span>  <span class='comment'># @param add_string [String] The string to append to the number.
</span>  <span class='comment'># @param k_separator [String] The string to use as thousands separator.
</span>  <span class='comment'># @return [Hash] The new formatters.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
      <span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of booleans.
</span>  <span class='comment'># @see Object#format_boolean
</span>  <span class='comment'>#
</span>  <span class='comment'># @param true_name [String|NilClass] The string representation of `true`. Defaults to `Yes`.
</span>  <span class='comment'># @param false_name [String|NilClass] The string representation of `false`. Defaults to `No`.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>boolean</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups custom formats for dates and times.
</span>  <span class='comment'># @see DateTime#lstrftime
</span>  <span class='comment'>#
</span>  <span class='comment'># @param formats [Hash|NilClass] The format to add or replace.
</span>  <span class='comment'># @param replace [Boolean] Whether to discard current formats.
</span>  <span class='comment'># @return [Hash] The new formats.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>

    <span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>ct_date:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%Y-%m-%d</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_time:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_date_time:</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='comma'>,</span> <span class='label'>ct_iso_8601:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%FT%T%z</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span><span class='rparen'>)</span>
    <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>

    <span class='ivar'>@date_formats</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of days and months.
</span>  <span class='comment'># @see DateTime::ClassMethods#days
</span>  <span class='comment'># @see DateTime::ClassMethods#months
</span>  <span class='comment'># @see Lazier::DateTime#format
</span>  <span class='comment'>#
</span>  <span class='comment'># @param long_months [Array|NilClass] The string representation of months.
</span>  <span class='comment'># @param short_months [Array|NilClass] The abbreviated string representation of months.
</span>  <span class='comment'># @param long_days [Array|NilClass] The string representation of days.
</span>  <span class='comment'># @param short_days [Array|NilClass] The abbreviated string representation of days.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>

    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
      <span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
    <span class='rbrace'>}</span>

    <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='comma'>,</span> <span class='symbol'>:indifferent</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="date_names-instance_method">
  
    #<strong>date_names</strong>  &#x21d2; <tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns String representations of days and months.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>String representations of days and months.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>

<span class='kw'>class</span> <span class='const'>Settings</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>

  <span class='comment'># Returns the singleton instance of the settings.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param force [Boolean] Whether to force recreation of the instance.
</span>  <span class='comment'># @return [Settings] The singleton instance of the settings.
</span>  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@instance</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_force'>force</span>
    <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
  <span class='kw'>end</span>

  <span class='comment'># Initializes a new settings object.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
    <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_load_datetime'>load_datetime</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
    <span class='id identifier rubyid_setup'>setup</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the current instance.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
    <span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
    <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
    <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
    <span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups formatters for a number.
</span>  <span class='comment'># @see Object#format_number
</span>  <span class='comment'>#
</span>  <span class='comment'># @param precision [Fixnum] The precision to show.
</span>  <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
</span>  <span class='comment'># @param add_string [String] The string to append to the number.
</span>  <span class='comment'># @param k_separator [String] The string to use as thousands separator.
</span>  <span class='comment'># @return [Hash] The new formatters.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
      <span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of booleans.
</span>  <span class='comment'># @see Object#format_boolean
</span>  <span class='comment'>#
</span>  <span class='comment'># @param true_name [String|NilClass] The string representation of `true`. Defaults to `Yes`.
</span>  <span class='comment'># @param false_name [String|NilClass] The string representation of `false`. Defaults to `No`.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>boolean</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups custom formats for dates and times.
</span>  <span class='comment'># @see DateTime#lstrftime
</span>  <span class='comment'>#
</span>  <span class='comment'># @param formats [Hash|NilClass] The format to add or replace.
</span>  <span class='comment'># @param replace [Boolean] Whether to discard current formats.
</span>  <span class='comment'># @return [Hash] The new formats.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>

    <span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>ct_date:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%Y-%m-%d</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_time:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_date_time:</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='comma'>,</span> <span class='label'>ct_iso_8601:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%FT%T%z</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span><span class='rparen'>)</span>
    <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>

    <span class='ivar'>@date_formats</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of days and months.
</span>  <span class='comment'># @see DateTime::ClassMethods#days
</span>  <span class='comment'># @see DateTime::ClassMethods#months
</span>  <span class='comment'># @see Lazier::DateTime#format
</span>  <span class='comment'>#
</span>  <span class='comment'># @param long_months [Array|NilClass] The string representation of months.
</span>  <span class='comment'># @param short_months [Array|NilClass] The abbreviated string representation of months.
</span>  <span class='comment'># @param long_days [Array|NilClass] The string representation of days.
</span>  <span class='comment'># @param short_days [Array|NilClass] The abbreviated string representation of days.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>

    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
      <span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
    <span class='rbrace'>}</span>

    <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='comma'>,</span> <span class='symbol'>:indifferent</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="format_number-instance_method">
  
    #<strong>format_number</strong>  &#x21d2; <tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns Settings for numbers formatting.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>Settings for numbers formatting.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>

<span class='kw'>class</span> <span class='const'>Settings</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>

  <span class='comment'># Returns the singleton instance of the settings.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param force [Boolean] Whether to force recreation of the instance.
</span>  <span class='comment'># @return [Settings] The singleton instance of the settings.
</span>  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@instance</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_force'>force</span>
    <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
  <span class='kw'>end</span>

  <span class='comment'># Initializes a new settings object.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
    <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_load_datetime'>load_datetime</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
    <span class='id identifier rubyid_setup'>setup</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the current instance.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
    <span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
    <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
    <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
    <span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups formatters for a number.
</span>  <span class='comment'># @see Object#format_number
</span>  <span class='comment'>#
</span>  <span class='comment'># @param precision [Fixnum] The precision to show.
</span>  <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
</span>  <span class='comment'># @param add_string [String] The string to append to the number.
</span>  <span class='comment'># @param k_separator [String] The string to use as thousands separator.
</span>  <span class='comment'># @return [Hash] The new formatters.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
      <span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of booleans.
</span>  <span class='comment'># @see Object#format_boolean
</span>  <span class='comment'>#
</span>  <span class='comment'># @param true_name [String|NilClass] The string representation of `true`. Defaults to `Yes`.
</span>  <span class='comment'># @param false_name [String|NilClass] The string representation of `false`. Defaults to `No`.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>boolean</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups custom formats for dates and times.
</span>  <span class='comment'># @see DateTime#lstrftime
</span>  <span class='comment'>#
</span>  <span class='comment'># @param formats [Hash|NilClass] The format to add or replace.
</span>  <span class='comment'># @param replace [Boolean] Whether to discard current formats.
</span>  <span class='comment'># @return [Hash] The new formats.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>

    <span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>ct_date:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%Y-%m-%d</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_time:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_date_time:</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='comma'>,</span> <span class='label'>ct_iso_8601:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%FT%T%z</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span><span class='rparen'>)</span>
    <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>

    <span class='ivar'>@date_formats</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of days and months.
</span>  <span class='comment'># @see DateTime::ClassMethods#days
</span>  <span class='comment'># @see DateTime::ClassMethods#months
</span>  <span class='comment'># @see Lazier::DateTime#format
</span>  <span class='comment'>#
</span>  <span class='comment'># @param long_months [Array|NilClass] The string representation of months.
</span>  <span class='comment'># @param short_months [Array|NilClass] The abbreviated string representation of months.
</span>  <span class='comment'># @param long_days [Array|NilClass] The string representation of days.
</span>  <span class='comment'># @param short_days [Array|NilClass] The abbreviated string representation of days.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>

    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
      <span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
    <span class='rbrace'>}</span>

    <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='comma'>,</span> <span class='symbol'>:indifferent</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="i18n-instance_method">
  
    #<strong>i18n</strong>  &#x21d2; <tt>R18n::Translation</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns The translation object.</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>R18n::Translation</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The translation object.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>

<span class='kw'>class</span> <span class='const'>Settings</span>
  <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>

  <span class='comment'># Returns the singleton instance of the settings.
</span>  <span class='comment'>#
</span>  <span class='comment'># @param force [Boolean] Whether to force recreation of the instance.
</span>  <span class='comment'># @return [Settings] The singleton instance of the settings.
</span>  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@instance</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_force'>force</span>
    <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
  <span class='kw'>end</span>

  <span class='comment'># Initializes a new settings object.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
    <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_load_datetime'>load_datetime</span>
    <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
    <span class='id identifier rubyid_setup'>setup</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups the current instance.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
    <span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
    <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
    <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
    <span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups formatters for a number.
</span>  <span class='comment'># @see Object#format_number
</span>  <span class='comment'>#
</span>  <span class='comment'># @param precision [Fixnum] The precision to show.
</span>  <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
</span>  <span class='comment'># @param add_string [String] The string to append to the number.
</span>  <span class='comment'># @param k_separator [String] The string to use as thousands separator.
</span>  <span class='comment'># @return [Hash] The new formatters.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
      <span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
    <span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of booleans.
</span>  <span class='comment'># @see Object#format_boolean
</span>  <span class='comment'>#
</span>  <span class='comment'># @param true_name [String|NilClass] The string representation of `true`. Defaults to `Yes`.
</span>  <span class='comment'># @param false_name [String|NilClass] The string representation of `false`. Defaults to `No`.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>boolean</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups custom formats for dates and times.
</span>  <span class='comment'># @see DateTime#lstrftime
</span>  <span class='comment'>#
</span>  <span class='comment'># @param formats [Hash|NilClass] The format to add or replace.
</span>  <span class='comment'># @param replace [Boolean] Whether to discard current formats.
</span>  <span class='comment'># @return [Hash] The new formats.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>

    <span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>ct_date:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%Y-%m-%d</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_time:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_date_time:</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='comma'>,</span> <span class='label'>ct_iso_8601:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%FT%T%z</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span><span class='rparen'>)</span>
    <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>

    <span class='ivar'>@date_formats</span>
  <span class='kw'>end</span>

  <span class='comment'># Setups strings representation of days and months.
</span>  <span class='comment'># @see DateTime::ClassMethods#days
</span>  <span class='comment'># @see DateTime::ClassMethods#months
</span>  <span class='comment'># @see Lazier::DateTime#format
</span>  <span class='comment'>#
</span>  <span class='comment'># @param long_months [Array|NilClass] The string representation of months.
</span>  <span class='comment'># @param short_months [Array|NilClass] The abbreviated string representation of months.
</span>  <span class='comment'># @param long_days [Array|NilClass] The string representation of days.
</span>  <span class='comment'># @param short_days [Array|NilClass] The abbreviated string representation of days.
</span>  <span class='comment'># @return [Hash] The new representations.
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>

    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
      <span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
      <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
    <span class='rbrace'>}</span>

    <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='comma'>,</span> <span class='symbol'>:indifferent</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_private'>private</span>

  <span class='comment'># :nodoc:
</span>  <span class='kw'>def</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>
    <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>date</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="instance-class_method">
  
    .<strong>instance</strong>(force = false)  &#x21d2; <tt><span class='object_link'><a href="" title="Lazier::Settings (class)">Settings</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Returns the singleton instance of the settings.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>force</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
      
      
        <em class="default">(defaults to: <tt>false</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>Whether to force recreation of the instance.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="" title="Lazier::Settings (class)">Settings</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The singleton instance of the settings.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


26
27
28
29</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 26</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
  <span class='ivar'>@instance</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_force'>force</span>
  <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="setup-instance_method">
  
    #<strong>setup</strong>  &#x21d2; <tt><span class='object_link'><a href="Object.html" title="Lazier::Object (module)">Object</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Setups the current instance.</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


39
40
41
42
43
44</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 39</span>

<span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
  <span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
  <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
  <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
  <span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="setup_boolean_names-instance_method">
  
    #<strong>setup_boolean_names</strong>(true_name: nil, false_name: nil)  &#x21d2; <tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Setups strings representation of booleans.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>true_name</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span>|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The string representation of <code>true</code>. Defaults to <code>Yes</code>.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>false_name</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span>|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The string representation of <code>false</code>. Defaults to <code>No</code>.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The new representations.</p>
</div>
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li><span class='object_link'><a href="Object.html#format_boolean-instance_method" title="Lazier::Object#format_boolean (method)">Object#format_boolean</a></span></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


66
67
68
69</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 66</span>

<span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>boolean</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="setup_date_formats-instance_method">
  
    #<strong>setup_date_formats</strong>(formats = nil, replace = false)  &#x21d2; <tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Setups custom formats for dates and times.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>formats</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span>|NilClass</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The format to add or replace.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>replace</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
      
      
        <em class="default">(defaults to: <tt>false</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>Whether to discard current formats.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The new formats.</p>
</div>
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li>DateTime#lstrftime</li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


77
78
79
80
81
82
83
84
85</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 77</span>

<span class='kw'>def</span> <span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
  <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>

  <span class='id identifier rubyid_formats'>formats</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>ct_date:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%Y-%m-%d</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_time:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>ct_date_time:</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='comma'>,</span> <span class='label'>ct_iso_8601:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%FT%T%z</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
  <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_formats'>formats</span><span class='rparen'>)</span>
  <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>

  <span class='ivar'>@date_formats</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="setup_date_names-instance_method">
  
    #<strong>setup_date_names</strong>(long_months: nil, short_months: nil, long_days: nil, short_days: nil)  &#x21d2; <tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Setups strings representation of days and months.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>long_months</span>
      
      
        <span class='type'>(<tt>Array|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The string representation of months.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>short_months</span>
      
      
        <span class='type'>(<tt>Array|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The abbreviated string representation of months.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>long_days</span>
      
      
        <span class='type'>(<tt>Array|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The string representation of days.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>short_days</span>
      
      
        <span class='type'>(<tt>Array|NilClass</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The abbreviated string representation of days.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The new representations.</p>
</div>
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li><span class='object_link'><a href="DateTime/ClassMethods.html#days-instance_method" title="Lazier::DateTime::ClassMethods#days (method)">DateTime::ClassMethods#days</a></span></li>
    
      <li><span class='object_link'><a href="DateTime/ClassMethods.html#months-instance_method" title="Lazier::DateTime::ClassMethods#months (method)">DateTime::ClassMethods#months</a></span></li>
    
      <li><span class='object_link'><a href="DateTime.html#format-instance_method" title="Lazier::DateTime#format (method)">DateTime#format</a></span></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


97
98
99
100
101
102
103
104
105
106
107
108
109</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 97</span>

<span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_prepare_definitions'>prepare_definitions</span>

  <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
    <span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
    <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
    <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
    <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
  <span class='rbrace'>}</span>

  <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
  <span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='ivar'>@date_names</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='comma'>,</span> <span class='symbol'>:indifferent</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="setup_format_number-instance_method">
  
    #<strong>setup_format_number</strong>(precision: 2, decimal_separator: &quot;.&quot;, add_string: nil, k_separator: &quot;,&quot;)  &#x21d2; <tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Setups formatters for a number.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>precision</span>
      
      
        <span class='type'>(<tt>Fixnum</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The precision to show.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>decimal_separator</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 string to use as decimal separator.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>add_string</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 string to append to the number.</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>k_separator</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 string to use as thousands separator.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>The new formatters.</p>
</div>
      
    </li>
  
</ul>

  <p class="tag_title">See Also:</p>
  <ul class="see">
    
      <li><span class='object_link'><a href="Object.html#format_number-instance_method" title="Lazier::Object#format_number (method)">Object#format_number</a></span></li>
    
  </ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


54
55
56
57
58</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 54</span>

<span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
    <span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
  <span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Thu Nov 10 11:39:24 2016 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.5 (ruby-2.3.0).
</div>

    </div>
  </body>
</html>