lazier 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -334,7 +334,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
334
334
  <li class="public ">
335
335
  <span class="summary_signature">
336
336
 
337
- <a href="#localize-class_method" title="localize (class method)">+ (Object) <strong>localize</strong>(locale = nil) </a>
337
+ <a href="#localize-class_method" title="localize (class method)">+ (R18n::Translation) <strong>localize</strong>(locale = nil) </a>
338
338
 
339
339
 
340
340
 
@@ -438,7 +438,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
438
438
 
439
439
 
440
440
  &mdash;
441
- <div class='inline'><p>The translation</p>
441
+ <div class='inline'><p>The translation object.</p>
442
442
  </div>
443
443
 
444
444
  </li>
@@ -461,7 +461,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
461
461
 
462
462
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span>
463
463
  <span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_localize'>localize</span> <span class='kw'>if</span> <span class='op'>!</span><span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_localized?'>localized?</span>
464
- <span class='op'>::</span><span class='const'>R18n</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:t</span><span class='rparen'>)</span>
464
+ <span class='ivar'>@i18n</span>
465
465
  <span class='kw'>end</span></pre>
466
466
  </td>
467
467
  </tr>
@@ -923,7 +923,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
923
923
  <div class="method_details ">
924
924
  <h3 class="signature " id="localize-class_method">
925
925
 
926
- + (<tt><span class='object_link'><a href="Lazier/Object.html" title="Lazier::Object (module)">Object</a></span></tt>) <strong>localize</strong>(locale = nil)
926
+ + (<tt>R18n::Translation</tt>) <strong>localize</strong>(locale = nil)
927
927
 
928
928
 
929
929
 
@@ -959,6 +959,23 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
959
959
 
960
960
  </ul>
961
961
 
962
+ <p class="tag_title">Returns:</p>
963
+ <ul class="return">
964
+
965
+ <li>
966
+
967
+
968
+ <span class='type'>(<tt>R18n::Translation</tt>)</span>
969
+
970
+
971
+
972
+ &mdash;
973
+ <div class='inline'><p>The new translation object.</p>
974
+ </div>
975
+
976
+ </li>
977
+
978
+ </ul>
962
979
 
963
980
  </div><table class="source_code">
964
981
  <tr>
@@ -966,17 +983,17 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
966
983
  <pre class="lines">
967
984
 
968
985
 
969
- 140
970
986
  141
971
987
  142
972
- 143</pre>
988
+ 143
989
+ 144</pre>
973
990
  </td>
974
991
  <td>
975
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 140</span>
992
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 141</span>
976
993
 
977
994
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_localize'>localize</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
978
995
  <span class='ivar'>@i18n_locales_path</span> <span class='op'>||=</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>
979
- <span class='id identifier rubyid_locale'>locale</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>R18n</span><span class='period'>.</span><span class='id identifier rubyid_set'>set</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='ivar'>@i18n_locales_path</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='op'>::</span><span class='const'>R18n</span><span class='period'>.</span><span class='id identifier rubyid_set'>set</span><span class='lparen'>(</span><span class='symbol'>:en</span><span class='comma'>,</span> <span class='ivar'>@i18n_locales_path</span><span class='rparen'>)</span>
996
+ <span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>LANG</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>R18n</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_system_locale'>system_locale</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='comma'>,</span> <span class='ivar'>@i18n_locales_path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_lazier'>lazier</span>
980
997
  <span class='kw'>end</span></pre>
981
998
  </td>
982
999
  </tr>
@@ -1025,15 +1042,15 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
1025
1042
  <pre class="lines">
1026
1043
 
1027
1044
 
1028
- 148
1029
1045
  149
1030
- 150</pre>
1046
+ 150
1047
+ 151</pre>
1031
1048
  </td>
1032
1049
  <td>
1033
- <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 148</span>
1050
+ <pre class="code"><span class="info file"># File 'lib/lazier.rb', line 149</span>
1034
1051
 
1035
1052
  <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_localized?'>localized?</span>
1036
- <span class='ivar'>@i18n_locales_path</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
1053
+ <span class='ivar'>@i18n</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
1037
1054
  <span class='kw'>end</span></pre>
1038
1055
  </td>
1039
1056
  </tr>
@@ -1104,7 +1121,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
1104
1121
  </div>
1105
1122
 
1106
1123
  <div id="footer">
1107
- Generated on Tue Jan 29 08:17:34 2013 by
1124
+ Generated on Tue Jan 29 09:19:01 2013 by
1108
1125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1109
1126
  0.8.3 (ruby-1.9.3).
1110
1127
  </div>
@@ -288,7 +288,7 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Tue Jan 29 08:17:34 2013 by
291
+ Generated on Tue Jan 29 09:19:01 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>
@@ -730,7 +730,7 @@
730
730
  </div>
731
731
 
732
732
  <div id="footer">
733
- Generated on Tue Jan 29 08:17:34 2013 by
733
+ Generated on Tue Jan 29 09:19:01 2013 by
734
734
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
735
735
  0.8.3 (ruby-1.9.3).
736
736
  </div>
@@ -1561,7 +1561,7 @@
1561
1561
  </div>
1562
1562
 
1563
1563
  <div id="footer">
1564
- Generated on Tue Jan 29 08:17:34 2013 by
1564
+ Generated on Tue Jan 29 09:19:01 2013 by
1565
1565
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1566
1566
  0.8.3 (ruby-1.9.3).
1567
1567
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Tue Jan 29 08:17:34 2013 by
119
+ Generated on Tue Jan 29 09:19:02 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 Tue Jan 29 08:17:35 2013 by
127
+ Generated on Tue Jan 29 09:19:02 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 Tue Jan 29 08:17:34 2013 by
387
+ Generated on Tue Jan 29 09:19:01 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>
@@ -121,7 +121,7 @@
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Tue Jan 29 08:17:34 2013 by
124
+ Generated on Tue Jan 29 09:19:01 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 Tue Jan 29 08:17:34 2013 by
324
+ Generated on Tue Jan 29 09:19:01 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 Tue Jan 29 08:17:34 2013 by
1589
+ Generated on Tue Jan 29 09:19:01 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 Tue Jan 29 08:17:34 2013 by
219
+ Generated on Tue Jan 29 09:19:01 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>
@@ -236,7 +236,7 @@
236
236
  <li class="public ">
237
237
  <span class="summary_signature">
238
238
 
239
- <a href="#instance-class_method" title="instance (class method)">+ (Settings) <strong>instance</strong> </a>
239
+ <a href="#instance-class_method" title="instance (class method)">+ (Settings) <strong>instance</strong>(force = false) </a>
240
240
 
241
241
 
242
242
 
@@ -413,15 +413,15 @@
413
413
  <pre class="lines">
414
414
 
415
415
 
416
- 28
417
- 29
418
416
  30
419
417
  31
420
418
  32
421
- 33</pre>
419
+ 33
420
+ 34
421
+ 35</pre>
422
422
  </td>
423
423
  <td>
424
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 28</span>
424
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 30</span>
425
425
 
426
426
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
427
427
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
@@ -685,7 +685,7 @@
685
685
  <div class="method_details first">
686
686
  <h3 class="signature first" id="instance-class_method">
687
687
 
688
- + (<tt><span class='object_link'><a href="" title="Lazier::Settings (class)">Settings</a></span></tt>) <strong>instance</strong>
688
+ + (<tt><span class='object_link'><a href="" title="Lazier::Settings (class)">Settings</a></span></tt>) <strong>instance</strong>(force = false)
689
689
 
690
690
 
691
691
 
@@ -699,7 +699,28 @@
699
699
  </div>
700
700
  </div>
701
701
  <div class="tags">
702
+ <p class="tag_title">Parameters:</p>
703
+ <ul class="param">
702
704
 
705
+ <li>
706
+
707
+ <span class='name'>force</span>
708
+
709
+
710
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
711
+
712
+
713
+ <em class="default">(defaults to: <tt>false</tt>)</em>
714
+
715
+
716
+ &mdash;
717
+ <div class='inline'><p>If to force recreation of the instance.</p>
718
+ </div>
719
+
720
+ </li>
721
+
722
+ </ul>
723
+
703
724
  <p class="tag_title">Returns:</p>
704
725
  <ul class="return">
705
726
 
@@ -724,14 +745,16 @@
724
745
  <pre class="lines">
725
746
 
726
747
 
727
- 23
728
748
  24
729
- 25</pre>
749
+ 25
750
+ 26
751
+ 27</pre>
730
752
  </td>
731
753
  <td>
732
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 23</span>
754
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 24</span>
733
755
 
734
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
756
+ <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>
757
+ <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>
735
758
  <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>
736
759
  <span class='kw'>end</span></pre>
737
760
  </td>
@@ -832,14 +855,14 @@
832
855
  <pre class="lines">
833
856
 
834
857
 
835
- 53
836
- 54
837
858
  55
838
859
  56
839
- 57</pre>
860
+ 57
861
+ 58
862
+ 59</pre>
840
863
  </td>
841
864
  <td>
842
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 53</span>
865
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 55</span>
843
866
 
844
867
  <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>
845
868
  <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||=</span> <span class='const'>Lazier</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>
@@ -938,8 +961,6 @@
938
961
  <pre class="lines">
939
962
 
940
963
 
941
- 65
942
- 66
943
964
  67
944
965
  68
945
966
  69
@@ -953,10 +974,12 @@
953
974
  77
954
975
  78
955
976
  79
956
- 80</pre>
977
+ 80
978
+ 81
979
+ 82</pre>
957
980
  </td>
958
981
  <td>
959
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 65</span>
982
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 67</span>
960
983
 
961
984
  <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>
962
985
  <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>
@@ -1104,17 +1127,17 @@
1104
1127
  <pre class="lines">
1105
1128
 
1106
1129
 
1107
- 92
1108
- 93
1109
1130
  94
1110
1131
  95
1111
1132
  96
1112
1133
  97
1113
1134
  98
1114
- 99</pre>
1135
+ 99
1136
+ 100
1137
+ 101</pre>
1115
1138
  </td>
1116
1139
  <td>
1117
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 92</span>
1140
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 94</span>
1118
1141
 
1119
1142
  <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>
1120
1143
  <span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='const'>Lazier</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>
@@ -1250,12 +1273,12 @@
1250
1273
  <pre class="lines">
1251
1274
 
1252
1275
 
1253
- 43
1254
- 44
1255
- 45</pre>
1276
+ 45
1277
+ 46
1278
+ 47</pre>
1256
1279
  </td>
1257
1280
  <td>
1258
- <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 43</span>
1281
+ <pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 45</span>
1259
1282
 
1260
1283
  <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>
1261
1284
  <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>
@@ -1270,7 +1293,7 @@
1270
1293
  </div>
1271
1294
 
1272
1295
  <div id="footer">
1273
- Generated on Tue Jan 29 08:17:35 2013 by
1296
+ Generated on Tue Jan 29 09:19:02 2013 by
1274
1297
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1275
1298
  0.8.3 (ruby-1.9.3).
1276
1299
  </div>
@@ -462,7 +462,7 @@
462
462
  </div>
463
463
 
464
464
  <div id="footer">
465
- Generated on Tue Jan 29 08:17:34 2013 by
465
+ Generated on Tue Jan 29 09:19:01 2013 by
466
466
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
467
467
  0.8.3 (ruby-1.9.3).
468
468
  </div>
@@ -1711,7 +1711,7 @@
1711
1711
  </div>
1712
1712
 
1713
1713
  <div id="footer">
1714
- Generated on Tue Jan 29 08:17:34 2013 by
1714
+ Generated on Tue Jan 29 09:19:02 2013 by
1715
1715
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1716
1716
  0.8.3 (ruby-1.9.3).
1717
1717
  </div>
@@ -1026,7 +1026,7 @@
1026
1026
  </div>
1027
1027
 
1028
1028
  <div id="footer">
1029
- Generated on Tue Jan 29 08:17:34 2013 by
1029
+ Generated on Tue Jan 29 09:19:02 2013 by
1030
1030
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1031
1031
  0.8.3 (ruby-1.9.3).
1032
1032
  </div>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>0</span></pre></dd>
152
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
153
153
 
154
154
  <dt id="STRING-constant" class="">STRING =
155
155
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Tue Jan 29 08:17:34 2013 by
183
+ Generated on Tue Jan 29 09:19:01 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.3 (ruby-1.9.3).
186
186
  </div>
@@ -297,7 +297,7 @@
297
297
  </div>
298
298
 
299
299
  <div id="footer">
300
- Generated on Tue Jan 29 08:17:34 2013 by
300
+ Generated on Tue Jan 29 09:19:01 2013 by
301
301
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
302
302
  0.8.3 (ruby-1.9.3).
303
303
  </div>
@@ -102,7 +102,7 @@ See documentation for more informations.</p>
102
102
  </div></div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Tue Jan 29 08:17:34 2013 by
105
+ Generated on Tue Jan 29 09:19:01 2013 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.8.3 (ruby-1.9.3).
108
108
  </div>
@@ -102,7 +102,7 @@ See documentation for more informations.</p>
102
102
  </div></div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Tue Jan 29 08:17:34 2013 by
105
+ Generated on Tue Jan 29 09:19:01 2013 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.8.3 (ruby-1.9.3).
108
108
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Tue Jan 29 08:17:34 2013 by
106
+ Generated on Tue Jan 29 09:19:01 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.3 (ruby-1.9.3).
109
109
  </div>
@@ -128,24 +128,25 @@ module Lazier
128
128
 
129
129
  # Get the list of available translation for the current locale.
130
130
  #
131
- # @return [R18N::Translation] The translation
131
+ # @return [R18N::Translation] The translation object.
132
132
  def self.i18n
133
133
  Lazier.localize if !Lazier.localized?
134
- ::R18n.get.try(:t)
134
+ @i18n
135
135
  end
136
136
 
137
137
  # Set the current locale for messages.
138
138
  #
139
139
  # @param locale [String] The new locale. Default is the current system locale.
140
+ # @return [R18n::Translation] The new translation object.
140
141
  def self.localize(locale = nil)
141
142
  @i18n_locales_path ||= ::File.absolute_path(::Pathname.new(::File.dirname(__FILE__)).to_s + "/../locales/")
142
- locale ? ::R18n.set(locale, @i18n_locales_path) : ::R18n.set(:en, @i18n_locales_path)
143
+ @i18n = R18n::I18n.new([locale, ENV["LANG"], R18n::I18n.system_locale].compact, @i18n_locales_path).t.lazier
143
144
  end
144
145
 
145
146
  # Check whether the i18n support have been enabled.
146
147
  #
147
148
  # @return [Boolean] Whether the i18n support have been enabled or not.
148
149
  def self.localized?
149
- @i18n_locales_path.present?
150
+ @i18n.present?
150
151
  end
151
152
  end
@@ -19,8 +19,10 @@ module Lazier
19
19
 
20
20
  # Returns the singleton instance of the settings.
21
21
  #
22
+ # @param force [Boolean] If to force recreation of the instance.
22
23
  # @return [Settings] The singleton instance of the settings.
23
- def self.instance
24
+ def self.instance(force = false)
25
+ @instance = nil if force
24
26
  @instance ||= self.new
25
27
  end
26
28
 
@@ -13,10 +13,10 @@ module Lazier
13
13
  MAJOR = 2
14
14
 
15
15
  # The minor version.
16
- MINOR = 1
16
+ MINOR = 2
17
17
 
18
18
  # The patch version.
19
- PATCH = 1
19
+ PATCH = 0
20
20
 
21
21
  # The current version of lazier.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -5,49 +5,50 @@
5
5
  #
6
6
 
7
7
  ---
8
- boolean:
9
- - "Yes"
10
- - "No"
11
- date:
12
- long_months:
13
- - "January"
14
- - "February"
15
- - "March"
16
- - "April"
17
- - "May"
18
- - "June"
19
- - "July"
20
- - "August"
21
- - "September"
22
- - "October"
23
- - "November"
24
- - "December"
25
- short_months:
26
- - "Jan"
27
- - "Feb"
28
- - "Mar"
29
- - "Apr"
30
- - "May"
31
- - "Jun"
32
- - "Jul"
33
- - "Aug"
34
- - "Sep"
35
- - "Oct"
36
- - "Nov"
37
- - "Dec"
38
- long_days:
39
- - "Sunday"
40
- - "Monday"
41
- - "Tuesday"
42
- - "Wednesday"
43
- - "Thursday"
44
- - "Friday"
45
- - "Saturday"
46
- short_days:
47
- - "Sun"
48
- - "Mon"
49
- - "Tue"
50
- - "Wed"
51
- - "Thu"
52
- - "Fri"
53
- - "Sat"
8
+ lazier:
9
+ boolean:
10
+ - "Yes"
11
+ - "No"
12
+ date:
13
+ long_months:
14
+ - "January"
15
+ - "February"
16
+ - "March"
17
+ - "April"
18
+ - "May"
19
+ - "June"
20
+ - "July"
21
+ - "August"
22
+ - "September"
23
+ - "October"
24
+ - "November"
25
+ - "December"
26
+ short_months:
27
+ - "Jan"
28
+ - "Feb"
29
+ - "Mar"
30
+ - "Apr"
31
+ - "May"
32
+ - "Jun"
33
+ - "Jul"
34
+ - "Aug"
35
+ - "Sep"
36
+ - "Oct"
37
+ - "Nov"
38
+ - "Dec"
39
+ long_days:
40
+ - "Sunday"
41
+ - "Monday"
42
+ - "Tuesday"
43
+ - "Wednesday"
44
+ - "Thursday"
45
+ - "Friday"
46
+ - "Saturday"
47
+ short_days:
48
+ - "Sun"
49
+ - "Mon"
50
+ - "Tue"
51
+ - "Wed"
52
+ - "Thu"
53
+ - "Fri"
54
+ - "Sat"
@@ -5,48 +5,49 @@
5
5
  #
6
6
 
7
7
  ---
8
- boolean:
9
- - "Yes"
10
- - "No"
11
- date:
12
- long_months:
13
- - "Gennaio"
14
- - "Febbraio"
15
- - "Marzo"
16
- - "Aprile"
17
- - "Maggio"
18
- - "Giugno"
19
- - "Luglio"
20
- - "Agosto"
21
- - "Settembre"
22
- - "Ottobre"
23
- - "Novembre"
24
- - "Dicembre"
25
- short_monts:
26
- - "Gen"
27
- - "Feb"
28
- - "Mar"
29
- - "Apr"
30
- - "Mag"
31
- - "Giu"
32
- - "Lug"
33
- - "Ago"
34
- - "SetOtt"
35
- - "Nov"
36
- - "Dic"
37
- long_days:
38
- - "Domenica"
39
- - "Lunedì"
40
- - "Martedì"
41
- - "Mercoledì"
42
- - "Giovedì"
43
- - "Venerdì"
44
- - "Sabato"
45
- short_days:
46
- - "Dom"
47
- - "Lun"
48
- - "Mar"
49
- - "Mer"
50
- - "Gio"
51
- - "Ven"
52
- - "Sab"
8
+ lazier:
9
+ boolean:
10
+ - "Yes"
11
+ - "No"
12
+ date:
13
+ long_months:
14
+ - "Gennaio"
15
+ - "Febbraio"
16
+ - "Marzo"
17
+ - "Aprile"
18
+ - "Maggio"
19
+ - "Giugno"
20
+ - "Luglio"
21
+ - "Agosto"
22
+ - "Settembre"
23
+ - "Ottobre"
24
+ - "Novembre"
25
+ - "Dicembre"
26
+ short_monts:
27
+ - "Gen"
28
+ - "Feb"
29
+ - "Mar"
30
+ - "Apr"
31
+ - "Mag"
32
+ - "Giu"
33
+ - "Lug"
34
+ - "Ago"
35
+ - "SetOtt"
36
+ - "Nov"
37
+ - "Dic"
38
+ long_days:
39
+ - "Domenica"
40
+ - "Lunedì"
41
+ - "Martedì"
42
+ - "Mercoledì"
43
+ - "Giovedì"
44
+ - "Venerdì"
45
+ - "Sabato"
46
+ short_days:
47
+ - "Dom"
48
+ - "Lun"
49
+ - "Mar"
50
+ - "Mer"
51
+ - "Gio"
52
+ - "Ven"
53
+ - "Sab"
@@ -13,6 +13,8 @@ describe Lazier::DateTime do
13
13
  let(:zone_without_dst) { ::ActiveSupport::TimeZone["International Date Line West"] }
14
14
 
15
15
  before(:all) do
16
+ ::Lazier.localize(:en)
17
+ ::Lazier::Settings.instance(true)
16
18
  ::Lazier.load!
17
19
  end
18
20
 
@@ -205,6 +207,7 @@ describe Lazier::TimeZone do
205
207
 
206
208
  before(:all) do
207
209
  ::Lazier.load!
210
+ ::Lazier.localize(:en)
208
211
  end
209
212
 
210
213
  describe ".rationalize_offset" do
@@ -15,6 +15,23 @@ describe Lazier::Settings do
15
15
  Lazier.load!
16
16
  end
17
17
 
18
+ describe ".instance" do
19
+ it "should create a new instance" do
20
+ expect(::Lazier::Settings.instance).to be_a(::Lazier::Settings)
21
+ end
22
+
23
+ it "should always return the same instance" do
24
+ instance = ::Lazier::Settings.instance
25
+ ::Lazier::Settings.should_not_receive(:new)
26
+ expect(::Lazier::Settings.instance).to eq(instance)
27
+ end
28
+
29
+ it "should recreate an instance" do
30
+ other = ::Lazier::Settings.instance
31
+ expect(::Lazier::Settings.instance(true)).not_to eq(other)
32
+ end
33
+ end
34
+
18
35
  describe "#initialize" do
19
36
  it "should create good defaults" do
20
37
  settings = ::Lazier::Settings.new
@@ -45,16 +45,10 @@ describe Lazier do
45
45
 
46
46
  describe ".i18n" do
47
47
  it "should run localize if needed" do
48
- Lazier.instance_variable_set(:@i18n_locales_path, nil)
48
+ Lazier.instance_variable_set(:@i18n, nil)
49
49
  Lazier.should_receive(:localize)
50
50
  Lazier.i18n
51
51
  end
52
-
53
- it "should return a localizer object" do
54
- R18n.stub(:get).and_return(Object.new)
55
- R18n.get.should_receive(:try).with(:t)
56
- Lazier.i18n
57
- end
58
52
  end
59
53
 
60
54
  describe ".localize" do
@@ -63,20 +57,20 @@ describe Lazier do
63
57
  expect(Lazier.instance_variable_get(:@i18n_locales_path)).to eq(File.absolute_path(::Pathname.new(File.dirname(__FILE__)).to_s + "/../locales/"))
64
58
  end
65
59
 
66
- it "should set using English if called without arguments" do
67
- R18n.should_receive(:set).with(:en, File.absolute_path(::Pathname.new(File.dirname(__FILE__)).to_s + "/../locales/"))
60
+ it "should set using system locale if called without arguments" do
61
+ R18n::I18n.should_receive(:new).with([ENV["LANG"], R18n::I18n.system_locale].compact, File.absolute_path(::Pathname.new(File.dirname(__FILE__)).to_s + "/../locales/")).and_call_original
68
62
  Lazier.localize
69
63
  end
70
64
 
71
65
  it "should set the requested locale" do
72
- R18n.should_receive(:set).with(:it, File.absolute_path(::Pathname.new(File.dirname(__FILE__)).to_s + "/../locales/"))
66
+ R18n::I18n.should_receive(:new).with([:it, ENV["LANG"], R18n::I18n.system_locale].compact, File.absolute_path(::Pathname.new(File.dirname(__FILE__)).to_s + "/../locales/")).and_call_original
73
67
  Lazier.localize(:it)
74
68
  end
75
69
  end
76
70
 
77
71
  describe ".localize?" do
78
72
  it "should respect the value of the internal variable" do
79
- Lazier.instance_variable_set(:@i18n_locales_path, nil)
73
+ Lazier.instance_variable_set(:@i18n, nil)
80
74
  expect(Lazier.localized?).to be_false
81
75
  Lazier.localize(:en)
82
76
  expect(Lazier.localized?).to be_true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazier
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: