lazier 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -838,7 +838,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
838
838
  </div>
839
839
 
840
840
  <div id="footer">
841
- Generated on Thu Jan 31 20:15:55 2013 by
841
+ Generated on Sat Feb 2 09:19:08 2013 by
842
842
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
843
843
  0.8.3 (ruby-1.9.3).
844
844
  </div>
@@ -288,7 +288,7 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Thu Jan 31 20:15:55 2013 by
291
+ Generated on Sat Feb 2 09:19:08 2013 by
292
292
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
293
293
  0.8.3 (ruby-1.9.3).
294
294
  </div>
@@ -724,7 +724,7 @@
724
724
  </div>
725
725
 
726
726
  <div id="footer">
727
- Generated on Thu Jan 31 20:15:56 2013 by
727
+ Generated on Sat Feb 2 09:19:08 2013 by
728
728
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
729
729
  0.8.3 (ruby-1.9.3).
730
730
  </div>
@@ -1565,7 +1565,7 @@
1565
1565
  </div>
1566
1566
 
1567
1567
  <div id="footer">
1568
- Generated on Thu Jan 31 20:15:56 2013 by
1568
+ Generated on Sat Feb 2 09:19:08 2013 by
1569
1569
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1570
1570
  0.8.3 (ruby-1.9.3).
1571
1571
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Thu Jan 31 20:15:56 2013 by
119
+ Generated on Sat Feb 2 09:19:08 2013 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.3 (ruby-1.9.3).
122
122
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Thu Jan 31 20:15:56 2013 by
127
+ Generated on Sat Feb 2 09:19:09 2013 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.3 (ruby-1.9.3).
130
130
  </div>
@@ -384,7 +384,7 @@
384
384
  </div>
385
385
 
386
386
  <div id="footer">
387
- Generated on Thu Jan 31 20:15:55 2013 by
387
+ Generated on Sat Feb 2 09:19:08 2013 by
388
388
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
389
389
  0.8.3 (ruby-1.9.3).
390
390
  </div>
@@ -405,7 +405,7 @@
405
405
  </div>
406
406
 
407
407
  <div id="footer">
408
- Generated on Thu Jan 31 20:15:55 2013 by
408
+ Generated on Sat Feb 2 09:19:08 2013 by
409
409
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
410
410
  0.8.3 (ruby-1.9.3).
411
411
  </div>
@@ -121,7 +121,7 @@
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Thu Jan 31 20:15:55 2013 by
124
+ Generated on Sat Feb 2 09:19:08 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.3 (ruby-1.9.3).
127
127
  </div>
@@ -321,7 +321,7 @@
321
321
  </div>
322
322
 
323
323
  <div id="footer">
324
- Generated on Thu Jan 31 20:15:55 2013 by
324
+ Generated on Sat Feb 2 09:19:08 2013 by
325
325
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
326
326
  0.8.3 (ruby-1.9.3).
327
327
  </div>
@@ -1586,7 +1586,7 @@
1586
1586
  </div>
1587
1587
 
1588
1588
  <div id="footer">
1589
- Generated on Thu Jan 31 20:15:55 2013 by
1589
+ Generated on Sat Feb 2 09:19:08 2013 by
1590
1590
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1591
1591
  0.8.3 (ruby-1.9.3).
1592
1592
  </div>
@@ -216,7 +216,7 @@
216
216
  </div>
217
217
 
218
218
  <div id="footer">
219
- Generated on Thu Jan 31 20:15:55 2013 by
219
+ Generated on Sat Feb 2 09:19:08 2013 by
220
220
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
221
221
  0.8.3 (ruby-1.9.3).
222
222
  </div>
@@ -132,6 +132,8 @@
132
132
 
133
133
 
134
134
 
135
+ <span class="note title readonly">readonly</span>
136
+
135
137
 
136
138
 
137
139
 
@@ -158,6 +160,8 @@
158
160
 
159
161
 
160
162
 
163
+ <span class="note title readonly">readonly</span>
164
+
161
165
 
162
166
 
163
167
 
@@ -184,6 +188,8 @@
184
188
 
185
189
 
186
190
 
191
+ <span class="note title readonly">readonly</span>
192
+
187
193
 
188
194
 
189
195
 
@@ -210,6 +216,8 @@
210
216
 
211
217
 
212
218
 
219
+ <span class="note title readonly">readonly</span>
220
+
213
221
 
214
222
 
215
223
 
@@ -477,13 +485,13 @@
477
485
  <pre class="lines">
478
486
 
479
487
 
480
- 34
481
- 35
482
- 36
483
- 37</pre>
488
+ 38
489
+ 39
490
+ 40
491
+ 41</pre>
484
492
  </td>
485
493
  <td>
486
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 34</span>
494
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 38</span>
487
495
 
488
496
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
489
497
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
@@ -500,11 +508,11 @@
500
508
  <h2>Instance Attribute Details</h2>
501
509
 
502
510
 
503
- <span id="boolean_names=-instance_method"></span>
511
+ <span id=""></span>
504
512
  <div class="method_details first">
505
513
  <h3 class="signature first" id="boolean_names-instance_method">
506
514
 
507
- - (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>boolean_names</strong>
515
+ - (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>boolean_names</strong> <span class="extras">(readonly)</span>
508
516
 
509
517
 
510
518
 
@@ -530,7 +538,7 @@
530
538
 
531
539
 
532
540
  &mdash;
533
- <div class='inline'><p>the current value of boolean_names</p>
541
+ <div class='inline'><p>String representations of booleans.</p>
534
542
  </div>
535
543
 
536
544
  </li>
@@ -543,15 +551,221 @@
543
551
  <pre class="lines">
544
552
 
545
553
 
546
- 16
547
- 17
548
- 18</pre>
554
+ 20
555
+ 21
556
+ 22
557
+ 23
558
+ 24
559
+ 25
560
+ 26
561
+ 27
562
+ 28
563
+ 29
564
+ 30
565
+ 31
566
+ 32
567
+ 33
568
+ 34
569
+ 35
570
+ 36
571
+ 37
572
+ 38
573
+ 39
574
+ 40
575
+ 41
576
+ 42
577
+ 43
578
+ 44
579
+ 45
580
+ 46
581
+ 47
582
+ 48
583
+ 49
584
+ 50
585
+ 51
586
+ 52
587
+ 53
588
+ 54
589
+ 55
590
+ 56
591
+ 57
592
+ 58
593
+ 59
594
+ 60
595
+ 61
596
+ 62
597
+ 63
598
+ 64
599
+ 65
600
+ 66
601
+ 67
602
+ 68
603
+ 69
604
+ 70
605
+ 71
606
+ 72
607
+ 73
608
+ 74
609
+ 75
610
+ 76
611
+ 77
612
+ 78
613
+ 79
614
+ 80
615
+ 81
616
+ 82
617
+ 83
618
+ 84
619
+ 85
620
+ 86
621
+ 87
622
+ 88
623
+ 89
624
+ 90
625
+ 91
626
+ 92
627
+ 93
628
+ 94
629
+ 95
630
+ 96
631
+ 97
632
+ 98
633
+ 99
634
+ 100
635
+ 101
636
+ 102
637
+ 103
638
+ 104
639
+ 105
640
+ 106
641
+ 107
642
+ 108
643
+ 109
644
+ 110
645
+ 111
646
+ 112
647
+ 113
648
+ 114
649
+ 115
650
+ 116
651
+ 117
652
+ 118
653
+ 119
654
+ 120
655
+ 121
656
+ 122
657
+ 123
658
+ 124
659
+ 125</pre>
549
660
  </td>
550
661
  <td>
551
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 16</span>
662
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
663
+
664
+ <span class='kw'>class</span> <span class='const'>Settings</span>
665
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
666
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
667
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
668
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
669
+
670
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
671
+
672
+ <span class='comment'># Returns the singleton instance of the settings.
673
+ </span> <span class='comment'>#
674
+ </span> <span class='comment'># @param force [Boolean] If to force recreation of the instance.
675
+ </span> <span class='comment'># @return [Settings] The singleton instance of the settings.
676
+ </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>
677
+ <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>
678
+ <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
679
+ <span class='kw'>end</span>
680
+
681
+ <span class='comment'># Initializes a new settings object.
682
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
683
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
684
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
685
+ <span class='kw'>end</span>
686
+
687
+ <span class='comment'># Setups the current instance.
688
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
689
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
690
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
691
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
692
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
693
+ <span class='kw'>end</span>
694
+
695
+ <span class='comment'># Set the current locale for messages.
696
+ </span> <span class='comment'>#
697
+ </span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
698
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
699
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
700
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
701
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
702
+ <span class='kw'>end</span>
703
+
704
+ <span class='comment'># Setups formatters for a number.
705
+ </span> <span class='comment'># @see Object#format_number
706
+ </span> <span class='comment'>#
707
+ </span> <span class='comment'># @param prec [Fixnum] The precision to show.
708
+ </span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
709
+ </span> <span class='comment'># @param add_string [String] The string to append to the number.
710
+ </span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
711
+ </span> <span class='comment'># @return [Hash] The new formatters.
712
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
713
+ <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>prec:</span> <span class='id identifier rubyid_prec'>prec</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='rbrace'>}</span>
714
+ <span class='kw'>end</span>
715
+
716
+ <span class='comment'># Setups strings representation of booleans.
717
+ </span> <span class='comment'># @see Object#format_boolean
718
+ </span> <span class='comment'>#
719
+ </span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
720
+ </span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
721
+ </span> <span class='comment'># @return [Hash] The new representations.
722
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
723
+ <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
724
+ <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
725
+ <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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
726
+ <span class='kw'>end</span>
552
727
 
553
- <span class='kw'>def</span> <span class='id identifier rubyid_boolean_names'>boolean_names</span>
554
- <span class='ivar'>@boolean_names</span>
728
+ <span class='comment'># Setups custom formats for dates and times.
729
+ </span> <span class='comment'># @see DateTime#lstrftime
730
+ </span> <span class='comment'>#
731
+ </span> <span class='comment'># @param formats [Hash] The format to add or replace.
732
+ </span> <span class='comment'># @param replace [Boolean] If to discard current formats.
733
+ </span> <span class='comment'># @return [Hash] The new formats.
734
+ </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>
735
+ <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'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
736
+
737
+ <span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
738
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
739
+ <span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
740
+ <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>
741
+ <span class='kw'>else</span>
742
+ <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
743
+ <span class='kw'>end</span>
744
+
745
+ <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
746
+ <span class='kw'>end</span>
747
+
748
+ <span class='ivar'>@date_formats</span>
749
+ <span class='kw'>end</span>
750
+
751
+ <span class='comment'># Setups strings representation of days and months.
752
+ </span> <span class='comment'># @see DateTime::ClassMethods#days
753
+ </span> <span class='comment'># @see DateTime::ClassMethods#months
754
+ </span> <span class='comment'># @see DateTime#lstrftime
755
+ </span> <span class='comment'>#
756
+ </span> <span class='comment'># @param long_months [Array] The string representation of months.
757
+ </span> <span class='comment'># @param short_months [Array] The abbreviated string representation of months.
758
+ </span> <span class='comment'># @param long_days [Array] The string representation of days.
759
+ </span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
760
+ </span> <span class='comment'># @return [Hash] The new representations.
761
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
762
+ <span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
763
+ <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
764
+ <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
765
+ <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
766
+
767
+ <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='comma'>,</span> <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='rbrace'>}</span>
768
+ <span class='kw'>end</span>
555
769
  <span class='kw'>end</span></pre>
556
770
  </td>
557
771
  </tr>
@@ -559,11 +773,11 @@
559
773
  </div>
560
774
 
561
775
 
562
- <span id="date_formats=-instance_method"></span>
776
+ <span id=""></span>
563
777
  <div class="method_details ">
564
778
  <h3 class="signature " id="date_formats-instance_method">
565
779
 
566
- - (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>date_formats</strong>
780
+ - (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>date_formats</strong> <span class="extras">(readonly)</span>
567
781
 
568
782
 
569
783
 
@@ -589,7 +803,7 @@
589
803
 
590
804
 
591
805
  &mdash;
592
- <div class='inline'><p>the current value of date_formats</p>
806
+ <div class='inline'><p>Custom date and time formats.</p>
593
807
  </div>
594
808
 
595
809
  </li>
@@ -602,15 +816,221 @@
602
816
  <pre class="lines">
603
817
 
604
818
 
605
- 16
606
- 17
607
- 18</pre>
819
+ 20
820
+ 21
821
+ 22
822
+ 23
823
+ 24
824
+ 25
825
+ 26
826
+ 27
827
+ 28
828
+ 29
829
+ 30
830
+ 31
831
+ 32
832
+ 33
833
+ 34
834
+ 35
835
+ 36
836
+ 37
837
+ 38
838
+ 39
839
+ 40
840
+ 41
841
+ 42
842
+ 43
843
+ 44
844
+ 45
845
+ 46
846
+ 47
847
+ 48
848
+ 49
849
+ 50
850
+ 51
851
+ 52
852
+ 53
853
+ 54
854
+ 55
855
+ 56
856
+ 57
857
+ 58
858
+ 59
859
+ 60
860
+ 61
861
+ 62
862
+ 63
863
+ 64
864
+ 65
865
+ 66
866
+ 67
867
+ 68
868
+ 69
869
+ 70
870
+ 71
871
+ 72
872
+ 73
873
+ 74
874
+ 75
875
+ 76
876
+ 77
877
+ 78
878
+ 79
879
+ 80
880
+ 81
881
+ 82
882
+ 83
883
+ 84
884
+ 85
885
+ 86
886
+ 87
887
+ 88
888
+ 89
889
+ 90
890
+ 91
891
+ 92
892
+ 93
893
+ 94
894
+ 95
895
+ 96
896
+ 97
897
+ 98
898
+ 99
899
+ 100
900
+ 101
901
+ 102
902
+ 103
903
+ 104
904
+ 105
905
+ 106
906
+ 107
907
+ 108
908
+ 109
909
+ 110
910
+ 111
911
+ 112
912
+ 113
913
+ 114
914
+ 115
915
+ 116
916
+ 117
917
+ 118
918
+ 119
919
+ 120
920
+ 121
921
+ 122
922
+ 123
923
+ 124
924
+ 125</pre>
608
925
  </td>
609
926
  <td>
610
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 16</span>
927
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
928
+
929
+ <span class='kw'>class</span> <span class='const'>Settings</span>
930
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
931
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
932
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
933
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
934
+
935
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
936
+
937
+ <span class='comment'># Returns the singleton instance of the settings.
938
+ </span> <span class='comment'>#
939
+ </span> <span class='comment'># @param force [Boolean] If to force recreation of the instance.
940
+ </span> <span class='comment'># @return [Settings] The singleton instance of the settings.
941
+ </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>
942
+ <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>
943
+ <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
944
+ <span class='kw'>end</span>
611
945
 
612
- <span class='kw'>def</span> <span class='id identifier rubyid_date_formats'>date_formats</span>
613
- <span class='ivar'>@date_formats</span>
946
+ <span class='comment'># Initializes a new settings object.
947
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
948
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
949
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
950
+ <span class='kw'>end</span>
951
+
952
+ <span class='comment'># Setups the current instance.
953
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
954
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
955
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
956
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
957
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
958
+ <span class='kw'>end</span>
959
+
960
+ <span class='comment'># Set the current locale for messages.
961
+ </span> <span class='comment'>#
962
+ </span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
963
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
964
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
965
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
966
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
967
+ <span class='kw'>end</span>
968
+
969
+ <span class='comment'># Setups formatters for a number.
970
+ </span> <span class='comment'># @see Object#format_number
971
+ </span> <span class='comment'>#
972
+ </span> <span class='comment'># @param prec [Fixnum] The precision to show.
973
+ </span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
974
+ </span> <span class='comment'># @param add_string [String] The string to append to the number.
975
+ </span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
976
+ </span> <span class='comment'># @return [Hash] The new formatters.
977
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
978
+ <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>prec:</span> <span class='id identifier rubyid_prec'>prec</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='rbrace'>}</span>
979
+ <span class='kw'>end</span>
980
+
981
+ <span class='comment'># Setups strings representation of booleans.
982
+ </span> <span class='comment'># @see Object#format_boolean
983
+ </span> <span class='comment'>#
984
+ </span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
985
+ </span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
986
+ </span> <span class='comment'># @return [Hash] The new representations.
987
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
988
+ <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
989
+ <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
990
+ <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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
991
+ <span class='kw'>end</span>
992
+
993
+ <span class='comment'># Setups custom formats for dates and times.
994
+ </span> <span class='comment'># @see DateTime#lstrftime
995
+ </span> <span class='comment'>#
996
+ </span> <span class='comment'># @param formats [Hash] The format to add or replace.
997
+ </span> <span class='comment'># @param replace [Boolean] If to discard current formats.
998
+ </span> <span class='comment'># @return [Hash] The new formats.
999
+ </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>
1000
+ <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'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1001
+
1002
+ <span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
1003
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
1004
+ <span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1005
+ <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>
1006
+ <span class='kw'>else</span>
1007
+ <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
1008
+ <span class='kw'>end</span>
1009
+
1010
+ <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
1011
+ <span class='kw'>end</span>
1012
+
1013
+ <span class='ivar'>@date_formats</span>
1014
+ <span class='kw'>end</span>
1015
+
1016
+ <span class='comment'># Setups strings representation of days and months.
1017
+ </span> <span class='comment'># @see DateTime::ClassMethods#days
1018
+ </span> <span class='comment'># @see DateTime::ClassMethods#months
1019
+ </span> <span class='comment'># @see DateTime#lstrftime
1020
+ </span> <span class='comment'>#
1021
+ </span> <span class='comment'># @param long_months [Array] The string representation of months.
1022
+ </span> <span class='comment'># @param short_months [Array] The abbreviated string representation of months.
1023
+ </span> <span class='comment'># @param long_days [Array] The string representation of days.
1024
+ </span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
1025
+ </span> <span class='comment'># @return [Hash] The new representations.
1026
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1027
+ <span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1028
+ <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1029
+ <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1030
+ <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1031
+
1032
+ <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='comma'>,</span> <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='rbrace'>}</span>
1033
+ <span class='kw'>end</span>
614
1034
  <span class='kw'>end</span></pre>
615
1035
  </td>
616
1036
  </tr>
@@ -618,11 +1038,11 @@
618
1038
  </div>
619
1039
 
620
1040
 
621
- <span id="date_names=-instance_method"></span>
1041
+ <span id=""></span>
622
1042
  <div class="method_details ">
623
1043
  <h3 class="signature " id="date_names-instance_method">
624
1044
 
625
- - (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>date_names</strong>
1045
+ - (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>date_names</strong> <span class="extras">(readonly)</span>
626
1046
 
627
1047
 
628
1048
 
@@ -648,7 +1068,7 @@
648
1068
 
649
1069
 
650
1070
  &mdash;
651
- <div class='inline'><p>the current value of date_names</p>
1071
+ <div class='inline'><p>String representations of days and months.</p>
652
1072
  </div>
653
1073
 
654
1074
  </li>
@@ -661,15 +1081,221 @@
661
1081
  <pre class="lines">
662
1082
 
663
1083
 
664
- 16
665
- 17
666
- 18</pre>
1084
+ 20
1085
+ 21
1086
+ 22
1087
+ 23
1088
+ 24
1089
+ 25
1090
+ 26
1091
+ 27
1092
+ 28
1093
+ 29
1094
+ 30
1095
+ 31
1096
+ 32
1097
+ 33
1098
+ 34
1099
+ 35
1100
+ 36
1101
+ 37
1102
+ 38
1103
+ 39
1104
+ 40
1105
+ 41
1106
+ 42
1107
+ 43
1108
+ 44
1109
+ 45
1110
+ 46
1111
+ 47
1112
+ 48
1113
+ 49
1114
+ 50
1115
+ 51
1116
+ 52
1117
+ 53
1118
+ 54
1119
+ 55
1120
+ 56
1121
+ 57
1122
+ 58
1123
+ 59
1124
+ 60
1125
+ 61
1126
+ 62
1127
+ 63
1128
+ 64
1129
+ 65
1130
+ 66
1131
+ 67
1132
+ 68
1133
+ 69
1134
+ 70
1135
+ 71
1136
+ 72
1137
+ 73
1138
+ 74
1139
+ 75
1140
+ 76
1141
+ 77
1142
+ 78
1143
+ 79
1144
+ 80
1145
+ 81
1146
+ 82
1147
+ 83
1148
+ 84
1149
+ 85
1150
+ 86
1151
+ 87
1152
+ 88
1153
+ 89
1154
+ 90
1155
+ 91
1156
+ 92
1157
+ 93
1158
+ 94
1159
+ 95
1160
+ 96
1161
+ 97
1162
+ 98
1163
+ 99
1164
+ 100
1165
+ 101
1166
+ 102
1167
+ 103
1168
+ 104
1169
+ 105
1170
+ 106
1171
+ 107
1172
+ 108
1173
+ 109
1174
+ 110
1175
+ 111
1176
+ 112
1177
+ 113
1178
+ 114
1179
+ 115
1180
+ 116
1181
+ 117
1182
+ 118
1183
+ 119
1184
+ 120
1185
+ 121
1186
+ 122
1187
+ 123
1188
+ 124
1189
+ 125</pre>
667
1190
  </td>
668
1191
  <td>
669
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 16</span>
1192
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
1193
+
1194
+ <span class='kw'>class</span> <span class='const'>Settings</span>
1195
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
1196
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
1197
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
1198
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
1199
+
1200
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
1201
+
1202
+ <span class='comment'># Returns the singleton instance of the settings.
1203
+ </span> <span class='comment'>#
1204
+ </span> <span class='comment'># @param force [Boolean] If to force recreation of the instance.
1205
+ </span> <span class='comment'># @return [Settings] The singleton instance of the settings.
1206
+ </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>
1207
+ <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>
1208
+ <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
1209
+ <span class='kw'>end</span>
1210
+
1211
+ <span class='comment'># Initializes a new settings object.
1212
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
1213
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
1214
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
1215
+ <span class='kw'>end</span>
1216
+
1217
+ <span class='comment'># Setups the current instance.
1218
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
1219
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
1220
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
1221
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
1222
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
1223
+ <span class='kw'>end</span>
1224
+
1225
+ <span class='comment'># Set the current locale for messages.
1226
+ </span> <span class='comment'>#
1227
+ </span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
1228
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
1229
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
1230
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
1231
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
1232
+ <span class='kw'>end</span>
1233
+
1234
+ <span class='comment'># Setups formatters for a number.
1235
+ </span> <span class='comment'># @see Object#format_number
1236
+ </span> <span class='comment'>#
1237
+ </span> <span class='comment'># @param prec [Fixnum] The precision to show.
1238
+ </span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
1239
+ </span> <span class='comment'># @param add_string [String] The string to append to the number.
1240
+ </span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
1241
+ </span> <span class='comment'># @return [Hash] The new formatters.
1242
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1243
+ <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>prec:</span> <span class='id identifier rubyid_prec'>prec</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='rbrace'>}</span>
1244
+ <span class='kw'>end</span>
1245
+
1246
+ <span class='comment'># Setups strings representation of booleans.
1247
+ </span> <span class='comment'># @see Object#format_boolean
1248
+ </span> <span class='comment'>#
1249
+ </span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
1250
+ </span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
1251
+ </span> <span class='comment'># @return [Hash] The new representations.
1252
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1253
+ <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
1254
+ <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
1255
+ <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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
1256
+ <span class='kw'>end</span>
1257
+
1258
+ <span class='comment'># Setups custom formats for dates and times.
1259
+ </span> <span class='comment'># @see DateTime#lstrftime
1260
+ </span> <span class='comment'>#
1261
+ </span> <span class='comment'># @param formats [Hash] The format to add or replace.
1262
+ </span> <span class='comment'># @param replace [Boolean] If to discard current formats.
1263
+ </span> <span class='comment'># @return [Hash] The new formats.
1264
+ </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>
1265
+ <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'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1266
+
1267
+ <span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
1268
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
1269
+ <span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1270
+ <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>
1271
+ <span class='kw'>else</span>
1272
+ <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
1273
+ <span class='kw'>end</span>
1274
+
1275
+ <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
1276
+ <span class='kw'>end</span>
1277
+
1278
+ <span class='ivar'>@date_formats</span>
1279
+ <span class='kw'>end</span>
670
1280
 
671
- <span class='kw'>def</span> <span class='id identifier rubyid_date_names'>date_names</span>
672
- <span class='ivar'>@date_names</span>
1281
+ <span class='comment'># Setups strings representation of days and months.
1282
+ </span> <span class='comment'># @see DateTime::ClassMethods#days
1283
+ </span> <span class='comment'># @see DateTime::ClassMethods#months
1284
+ </span> <span class='comment'># @see DateTime#lstrftime
1285
+ </span> <span class='comment'>#
1286
+ </span> <span class='comment'># @param long_months [Array] The string representation of months.
1287
+ </span> <span class='comment'># @param short_months [Array] The abbreviated string representation of months.
1288
+ </span> <span class='comment'># @param long_days [Array] The string representation of days.
1289
+ </span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
1290
+ </span> <span class='comment'># @return [Hash] The new representations.
1291
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1292
+ <span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1293
+ <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1294
+ <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1295
+ <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1296
+
1297
+ <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='comma'>,</span> <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='rbrace'>}</span>
1298
+ <span class='kw'>end</span>
673
1299
  <span class='kw'>end</span></pre>
674
1300
  </td>
675
1301
  </tr>
@@ -677,11 +1303,11 @@
677
1303
  </div>
678
1304
 
679
1305
 
680
- <span id="format_number=-instance_method"></span>
1306
+ <span id=""></span>
681
1307
  <div class="method_details ">
682
1308
  <h3 class="signature " id="format_number-instance_method">
683
1309
 
684
- - (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>format_number</strong>
1310
+ - (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>format_number</strong> <span class="extras">(readonly)</span>
685
1311
 
686
1312
 
687
1313
 
@@ -707,7 +1333,7 @@
707
1333
 
708
1334
 
709
1335
  &mdash;
710
- <div class='inline'><p>the current value of format_number</p>
1336
+ <div class='inline'><p>Settings for numbers formatting.</p>
711
1337
  </div>
712
1338
 
713
1339
  </li>
@@ -720,15 +1346,221 @@
720
1346
  <pre class="lines">
721
1347
 
722
1348
 
723
- 16
724
- 17
725
- 18</pre>
1349
+ 20
1350
+ 21
1351
+ 22
1352
+ 23
1353
+ 24
1354
+ 25
1355
+ 26
1356
+ 27
1357
+ 28
1358
+ 29
1359
+ 30
1360
+ 31
1361
+ 32
1362
+ 33
1363
+ 34
1364
+ 35
1365
+ 36
1366
+ 37
1367
+ 38
1368
+ 39
1369
+ 40
1370
+ 41
1371
+ 42
1372
+ 43
1373
+ 44
1374
+ 45
1375
+ 46
1376
+ 47
1377
+ 48
1378
+ 49
1379
+ 50
1380
+ 51
1381
+ 52
1382
+ 53
1383
+ 54
1384
+ 55
1385
+ 56
1386
+ 57
1387
+ 58
1388
+ 59
1389
+ 60
1390
+ 61
1391
+ 62
1392
+ 63
1393
+ 64
1394
+ 65
1395
+ 66
1396
+ 67
1397
+ 68
1398
+ 69
1399
+ 70
1400
+ 71
1401
+ 72
1402
+ 73
1403
+ 74
1404
+ 75
1405
+ 76
1406
+ 77
1407
+ 78
1408
+ 79
1409
+ 80
1410
+ 81
1411
+ 82
1412
+ 83
1413
+ 84
1414
+ 85
1415
+ 86
1416
+ 87
1417
+ 88
1418
+ 89
1419
+ 90
1420
+ 91
1421
+ 92
1422
+ 93
1423
+ 94
1424
+ 95
1425
+ 96
1426
+ 97
1427
+ 98
1428
+ 99
1429
+ 100
1430
+ 101
1431
+ 102
1432
+ 103
1433
+ 104
1434
+ 105
1435
+ 106
1436
+ 107
1437
+ 108
1438
+ 109
1439
+ 110
1440
+ 111
1441
+ 112
1442
+ 113
1443
+ 114
1444
+ 115
1445
+ 116
1446
+ 117
1447
+ 118
1448
+ 119
1449
+ 120
1450
+ 121
1451
+ 122
1452
+ 123
1453
+ 124
1454
+ 125</pre>
726
1455
  </td>
727
1456
  <td>
728
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 16</span>
1457
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
1458
+
1459
+ <span class='kw'>class</span> <span class='const'>Settings</span>
1460
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
1461
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
1462
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
1463
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
1464
+
1465
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
1466
+
1467
+ <span class='comment'># Returns the singleton instance of the settings.
1468
+ </span> <span class='comment'>#
1469
+ </span> <span class='comment'># @param force [Boolean] If to force recreation of the instance.
1470
+ </span> <span class='comment'># @return [Settings] The singleton instance of the settings.
1471
+ </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>
1472
+ <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>
1473
+ <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
1474
+ <span class='kw'>end</span>
1475
+
1476
+ <span class='comment'># Initializes a new settings object.
1477
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
1478
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
1479
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
1480
+ <span class='kw'>end</span>
729
1481
 
730
- <span class='kw'>def</span> <span class='id identifier rubyid_format_number'>format_number</span>
731
- <span class='ivar'>@format_number</span>
1482
+ <span class='comment'># Setups the current instance.
1483
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
1484
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
1485
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
1486
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
1487
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
1488
+ <span class='kw'>end</span>
1489
+
1490
+ <span class='comment'># Set the current locale for messages.
1491
+ </span> <span class='comment'>#
1492
+ </span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
1493
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
1494
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
1495
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
1496
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
1497
+ <span class='kw'>end</span>
1498
+
1499
+ <span class='comment'># Setups formatters for a number.
1500
+ </span> <span class='comment'># @see Object#format_number
1501
+ </span> <span class='comment'>#
1502
+ </span> <span class='comment'># @param prec [Fixnum] The precision to show.
1503
+ </span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
1504
+ </span> <span class='comment'># @param add_string [String] The string to append to the number.
1505
+ </span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
1506
+ </span> <span class='comment'># @return [Hash] The new formatters.
1507
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1508
+ <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>prec:</span> <span class='id identifier rubyid_prec'>prec</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='rbrace'>}</span>
1509
+ <span class='kw'>end</span>
1510
+
1511
+ <span class='comment'># Setups strings representation of booleans.
1512
+ </span> <span class='comment'># @see Object#format_boolean
1513
+ </span> <span class='comment'>#
1514
+ </span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
1515
+ </span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
1516
+ </span> <span class='comment'># @return [Hash] The new representations.
1517
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1518
+ <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
1519
+ <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
1520
+ <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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
1521
+ <span class='kw'>end</span>
1522
+
1523
+ <span class='comment'># Setups custom formats for dates and times.
1524
+ </span> <span class='comment'># @see DateTime#lstrftime
1525
+ </span> <span class='comment'>#
1526
+ </span> <span class='comment'># @param formats [Hash] The format to add or replace.
1527
+ </span> <span class='comment'># @param replace [Boolean] If to discard current formats.
1528
+ </span> <span class='comment'># @return [Hash] The new formats.
1529
+ </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>
1530
+ <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'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1531
+
1532
+ <span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
1533
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
1534
+ <span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1535
+ <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>
1536
+ <span class='kw'>else</span>
1537
+ <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
1538
+ <span class='kw'>end</span>
1539
+
1540
+ <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
1541
+ <span class='kw'>end</span>
1542
+
1543
+ <span class='ivar'>@date_formats</span>
1544
+ <span class='kw'>end</span>
1545
+
1546
+ <span class='comment'># Setups strings representation of days and months.
1547
+ </span> <span class='comment'># @see DateTime::ClassMethods#days
1548
+ </span> <span class='comment'># @see DateTime::ClassMethods#months
1549
+ </span> <span class='comment'># @see DateTime#lstrftime
1550
+ </span> <span class='comment'>#
1551
+ </span> <span class='comment'># @param long_months [Array] The string representation of months.
1552
+ </span> <span class='comment'># @param short_months [Array] The abbreviated string representation of months.
1553
+ </span> <span class='comment'># @param long_days [Array] The string representation of days.
1554
+ </span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
1555
+ </span> <span class='comment'># @return [Hash] The new representations.
1556
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1557
+ <span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1558
+ <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1559
+ <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1560
+ <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1561
+
1562
+ <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='comma'>,</span> <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='rbrace'>}</span>
1563
+ <span class='kw'>end</span>
732
1564
  <span class='kw'>end</span></pre>
733
1565
  </td>
734
1566
  </tr>
@@ -766,7 +1598,7 @@
766
1598
 
767
1599
 
768
1600
  &mdash;
769
- <div class='inline'><p>the current value of i18n</p>
1601
+ <div class='inline'><p>The translation object.</p>
770
1602
  </div>
771
1603
 
772
1604
  </li>
@@ -779,15 +1611,221 @@
779
1611
  <pre class="lines">
780
1612
 
781
1613
 
782
- 16
783
- 17
784
- 18</pre>
1614
+ 20
1615
+ 21
1616
+ 22
1617
+ 23
1618
+ 24
1619
+ 25
1620
+ 26
1621
+ 27
1622
+ 28
1623
+ 29
1624
+ 30
1625
+ 31
1626
+ 32
1627
+ 33
1628
+ 34
1629
+ 35
1630
+ 36
1631
+ 37
1632
+ 38
1633
+ 39
1634
+ 40
1635
+ 41
1636
+ 42
1637
+ 43
1638
+ 44
1639
+ 45
1640
+ 46
1641
+ 47
1642
+ 48
1643
+ 49
1644
+ 50
1645
+ 51
1646
+ 52
1647
+ 53
1648
+ 54
1649
+ 55
1650
+ 56
1651
+ 57
1652
+ 58
1653
+ 59
1654
+ 60
1655
+ 61
1656
+ 62
1657
+ 63
1658
+ 64
1659
+ 65
1660
+ 66
1661
+ 67
1662
+ 68
1663
+ 69
1664
+ 70
1665
+ 71
1666
+ 72
1667
+ 73
1668
+ 74
1669
+ 75
1670
+ 76
1671
+ 77
1672
+ 78
1673
+ 79
1674
+ 80
1675
+ 81
1676
+ 82
1677
+ 83
1678
+ 84
1679
+ 85
1680
+ 86
1681
+ 87
1682
+ 88
1683
+ 89
1684
+ 90
1685
+ 91
1686
+ 92
1687
+ 93
1688
+ 94
1689
+ 95
1690
+ 96
1691
+ 97
1692
+ 98
1693
+ 99
1694
+ 100
1695
+ 101
1696
+ 102
1697
+ 103
1698
+ 104
1699
+ 105
1700
+ 106
1701
+ 107
1702
+ 108
1703
+ 109
1704
+ 110
1705
+ 111
1706
+ 112
1707
+ 113
1708
+ 114
1709
+ 115
1710
+ 116
1711
+ 117
1712
+ 118
1713
+ 119
1714
+ 120
1715
+ 121
1716
+ 122
1717
+ 123
1718
+ 124
1719
+ 125</pre>
785
1720
  </td>
786
1721
  <td>
787
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 16</span>
1722
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
1723
+
1724
+ <span class='kw'>class</span> <span class='const'>Settings</span>
1725
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
1726
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
1727
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
1728
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
1729
+
1730
+ <span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
1731
+
1732
+ <span class='comment'># Returns the singleton instance of the settings.
1733
+ </span> <span class='comment'>#
1734
+ </span> <span class='comment'># @param force [Boolean] If to force recreation of the instance.
1735
+ </span> <span class='comment'># @return [Settings] The singleton instance of the settings.
1736
+ </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>
1737
+ <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>
1738
+ <span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
1739
+ <span class='kw'>end</span>
1740
+
1741
+ <span class='comment'># Initializes a new settings object.
1742
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
1743
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
1744
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
1745
+ <span class='kw'>end</span>
1746
+
1747
+ <span class='comment'># Setups the current instance.
1748
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
1749
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
1750
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
1751
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
1752
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
1753
+ <span class='kw'>end</span>
788
1754
 
789
- <span class='kw'>def</span> <span class='id identifier rubyid_i18n'>i18n</span>
790
- <span class='ivar'>@i18n</span>
1755
+ <span class='comment'># Set the current locale for messages.
1756
+ </span> <span class='comment'>#
1757
+ </span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
1758
+ </span> <span class='comment'># @return [R18n::Translation] The new translation object.
1759
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n='>i18n=</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
1760
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
1761
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
1762
+ <span class='kw'>end</span>
1763
+
1764
+ <span class='comment'># Setups formatters for a number.
1765
+ </span> <span class='comment'># @see Object#format_number
1766
+ </span> <span class='comment'>#
1767
+ </span> <span class='comment'># @param prec [Fixnum] The precision to show.
1768
+ </span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
1769
+ </span> <span class='comment'># @param add_string [String] The string to append to the number.
1770
+ </span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
1771
+ </span> <span class='comment'># @return [Hash] The new formatters.
1772
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1773
+ <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>prec:</span> <span class='id identifier rubyid_prec'>prec</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='rbrace'>}</span>
1774
+ <span class='kw'>end</span>
1775
+
1776
+ <span class='comment'># Setups strings representation of booleans.
1777
+ </span> <span class='comment'># @see Object#format_boolean
1778
+ </span> <span class='comment'>#
1779
+ </span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
1780
+ </span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
1781
+ </span> <span class='comment'># @return [Hash] The new representations.
1782
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1783
+ <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
1784
+ <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
1785
+ <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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
1786
+ <span class='kw'>end</span>
1787
+
1788
+ <span class='comment'># Setups custom formats for dates and times.
1789
+ </span> <span class='comment'># @see DateTime#lstrftime
1790
+ </span> <span class='comment'>#
1791
+ </span> <span class='comment'># @param formats [Hash] The format to add or replace.
1792
+ </span> <span class='comment'># @param replace [Boolean] If to discard current formats.
1793
+ </span> <span class='comment'># @return [Hash] The new formats.
1794
+ </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>
1795
+ <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'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1796
+
1797
+ <span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
1798
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
1799
+ <span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
1800
+ <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>
1801
+ <span class='kw'>else</span>
1802
+ <span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
1803
+ <span class='kw'>end</span>
1804
+
1805
+ <span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
1806
+ <span class='kw'>end</span>
1807
+
1808
+ <span class='ivar'>@date_formats</span>
1809
+ <span class='kw'>end</span>
1810
+
1811
+ <span class='comment'># Setups strings representation of days and months.
1812
+ </span> <span class='comment'># @see DateTime::ClassMethods#days
1813
+ </span> <span class='comment'># @see DateTime::ClassMethods#months
1814
+ </span> <span class='comment'># @see DateTime#lstrftime
1815
+ </span> <span class='comment'>#
1816
+ </span> <span class='comment'># @param long_months [Array] The string representation of months.
1817
+ </span> <span class='comment'># @param short_months [Array] The abbreviated string representation of months.
1818
+ </span> <span class='comment'># @param long_days [Array] The string representation of days.
1819
+ </span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
1820
+ </span> <span class='comment'># @return [Hash] The new representations.
1821
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1822
+ <span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1823
+ <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1824
+ <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1825
+ <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span> <span class='kw'>if</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
1826
+
1827
+ <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='comma'>,</span> <span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='rbrace'>}</span>
1828
+ <span class='kw'>end</span>
791
1829
  <span class='kw'>end</span></pre>
792
1830
  </td>
793
1831
  </tr>
@@ -864,13 +1902,13 @@
864
1902
  <pre class="lines">
865
1903
 
866
1904
 
867
- 28
868
- 29
869
- 30
870
- 31</pre>
1905
+ 32
1906
+ 33
1907
+ 34
1908
+ 35</pre>
871
1909
  </td>
872
1910
  <td>
873
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 28</span>
1911
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 32</span>
874
1912
 
875
1913
  <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>
876
1914
  <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>
@@ -912,15 +1950,15 @@
912
1950
  <pre class="lines">
913
1951
 
914
1952
 
915
- 40
916
- 41
917
- 42
918
- 43
919
1953
  44
920
- 45</pre>
1954
+ 45
1955
+ 46
1956
+ 47
1957
+ 48
1958
+ 49</pre>
921
1959
  </td>
922
1960
  <td>
923
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 40</span>
1961
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 44</span>
924
1962
 
925
1963
  <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
926
1964
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
@@ -1020,14 +2058,14 @@
1020
2058
  <pre class="lines">
1021
2059
 
1022
2060
 
1023
- 74
1024
- 75
1025
- 76
1026
- 77
1027
- 78</pre>
2061
+ 78
2062
+ 79
2063
+ 80
2064
+ 81
2065
+ 82</pre>
1028
2066
  </td>
1029
2067
  <td>
1030
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 74</span>
2068
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 78</span>
1031
2069
 
1032
2070
  <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1033
2071
  <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
@@ -1126,10 +2164,6 @@
1126
2164
  <pre class="lines">
1127
2165
 
1128
2166
 
1129
- 86
1130
- 87
1131
- 88
1132
- 89
1133
2167
  90
1134
2168
  91
1135
2169
  92
@@ -1141,10 +2175,14 @@
1141
2175
  98
1142
2176
  99
1143
2177
  100
1144
- 101</pre>
2178
+ 101
2179
+ 102
2180
+ 103
2181
+ 104
2182
+ 105</pre>
1145
2183
  </td>
1146
2184
  <td>
1147
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 86</span>
2185
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 90</span>
1148
2186
 
1149
2187
  <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>
1150
2188
  <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'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
@@ -1292,17 +2330,17 @@
1292
2330
  <pre class="lines">
1293
2331
 
1294
2332
 
1295
- 113
1296
- 114
1297
- 115
1298
- 116
1299
2333
  117
1300
2334
  118
1301
2335
  119
1302
- 120</pre>
2336
+ 120
2337
+ 121
2338
+ 122
2339
+ 123
2340
+ 124</pre>
1303
2341
  </td>
1304
2342
  <td>
1305
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 113</span>
2343
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 117</span>
1306
2344
 
1307
2345
  <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1308
2346
  <span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='kw'>if</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
@@ -1438,12 +2476,12 @@
1438
2476
  <pre class="lines">
1439
2477
 
1440
2478
 
1441
- 64
1442
- 65
1443
- 66</pre>
2479
+ 68
2480
+ 69
2481
+ 70</pre>
1444
2482
  </td>
1445
2483
  <td>
1446
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 64</span>
2484
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 68</span>
1447
2485
 
1448
2486
  <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1449
2487
  <span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>prec:</span> <span class='id identifier rubyid_prec'>prec</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='rbrace'>}</span>
@@ -1458,7 +2496,7 @@
1458
2496
  </div>
1459
2497
 
1460
2498
  <div id="footer">
1461
- Generated on Thu Jan 31 20:15:56 2013 by
2499
+ Generated on Sat Feb 2 09:19:09 2013 by
1462
2500
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1463
2501
  0.8.3 (ruby-1.9.3).
1464
2502
  </div>