lazier 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/Lazier.html +30 -13
- data/doc/Lazier/Boolean.html +1 -1
- data/doc/Lazier/DateTime.html +1 -1
- data/doc/Lazier/DateTime/ClassMethods.html +1 -1
- data/doc/Lazier/Exceptions.html +1 -1
- data/doc/Lazier/Exceptions/Dump.html +1 -1
- data/doc/Lazier/Hash.html +1 -1
- data/doc/Lazier/Math.html +1 -1
- data/doc/Lazier/Math/ClassMethods.html +1 -1
- data/doc/Lazier/Object.html +1 -1
- data/doc/Lazier/Pathname.html +1 -1
- data/doc/Lazier/Settings.html +50 -27
- data/doc/Lazier/String.html +1 -1
- data/doc/Lazier/TimeZone.html +1 -1
- data/doc/Lazier/TimeZone/ClassMethods.html +1 -1
- data/doc/Lazier/Version.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +1 -1
- data/lib/lazier.rb +5 -4
- data/lib/lazier/settings.rb +3 -1
- data/lib/lazier/version.rb +2 -2
- data/locales/en.yml +47 -46
- data/locales/it.yml +46 -45
- data/spec/lazier/datetime_spec.rb +3 -0
- data/spec/lazier/settings_spec.rb +17 -0
- data/spec/lazier_spec.rb +5 -11
- metadata +1 -1
data/doc/Lazier.html
CHANGED
@@ -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)">+ (
|
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
|
—
|
441
|
-
<div class='inline'><p>The translation
|
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='
|
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
|
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
|
+
—
|
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
|
988
|
+
143
|
989
|
+
144</pre>
|
973
990
|
</td>
|
974
991
|
<td>
|
975
|
-
<pre class="code"><span class="info file"># File 'lib/lazier.rb', line
|
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'>"</span><span class='tstring_content'>/../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
979
|
-
<span class='
|
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'>"</span><span class='tstring_content'>LANG</span><span class='tstring_end'>"</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
|
1046
|
+
150
|
1047
|
+
151</pre>
|
1031
1048
|
</td>
|
1032
1049
|
<td>
|
1033
|
-
<pre class="code"><span class="info file"># File 'lib/lazier.rb', line
|
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'>@
|
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
|
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>
|
data/doc/Lazier/Boolean.html
CHANGED
@@ -288,7 +288,7 @@
|
|
288
288
|
</div>
|
289
289
|
|
290
290
|
<div id="footer">
|
291
|
-
Generated on Tue Jan 29
|
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>
|
data/doc/Lazier/DateTime.html
CHANGED
@@ -730,7 +730,7 @@
|
|
730
730
|
</div>
|
731
731
|
|
732
732
|
<div id="footer">
|
733
|
-
Generated on Tue Jan 29
|
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
|
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>
|
data/doc/Lazier/Exceptions.html
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on Tue Jan 29
|
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
|
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>
|
data/doc/Lazier/Hash.html
CHANGED
@@ -384,7 +384,7 @@
|
|
384
384
|
</div>
|
385
385
|
|
386
386
|
<div id="footer">
|
387
|
-
Generated on Tue Jan 29
|
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>
|
data/doc/Lazier/Math.html
CHANGED
@@ -121,7 +121,7 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on Tue Jan 29
|
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
|
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>
|
data/doc/Lazier/Object.html
CHANGED
@@ -1586,7 +1586,7 @@
|
|
1586
1586
|
</div>
|
1587
1587
|
|
1588
1588
|
<div id="footer">
|
1589
|
-
Generated on Tue Jan 29
|
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>
|
data/doc/Lazier/Pathname.html
CHANGED
@@ -216,7 +216,7 @@
|
|
216
216
|
</div>
|
217
217
|
|
218
218
|
<div id="footer">
|
219
|
-
Generated on Tue Jan 29
|
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>
|
data/doc/Lazier/Settings.html
CHANGED
@@ -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
|
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
|
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
|
+
—
|
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
|
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
|
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
|
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
|
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
|
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
|
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'>"</span><span class='tstring_content'>%Y-%m-%d</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>ct_time:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>ct_date_time:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%F %T</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>ct_iso_8601:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%FT%T%z</span><span class='tstring_end'>"</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
|
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
|
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
|
-
|
1254
|
-
|
1255
|
-
|
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
|
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'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</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'>"</span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</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
|
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>
|
data/doc/Lazier/String.html
CHANGED
@@ -462,7 +462,7 @@
|
|
462
462
|
</div>
|
463
463
|
|
464
464
|
<div id="footer">
|
465
|
-
Generated on Tue Jan 29
|
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>
|
data/doc/Lazier/TimeZone.html
CHANGED
@@ -1711,7 +1711,7 @@
|
|
1711
1711
|
</div>
|
1712
1712
|
|
1713
1713
|
<div id="footer">
|
1714
|
-
Generated on Tue Jan 29
|
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
|
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>
|
data/doc/Lazier/Version.html
CHANGED
@@ -149,7 +149,7 @@
|
|
149
149
|
|
150
150
|
</div>
|
151
151
|
</dt>
|
152
|
-
<dd><pre class="code"><span class='int'>
|
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
|
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>
|
data/doc/_index.html
CHANGED
@@ -297,7 +297,7 @@
|
|
297
297
|
</div>
|
298
298
|
|
299
299
|
<div id="footer">
|
300
|
-
Generated on Tue Jan 29
|
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>
|
data/doc/file.README.html
CHANGED
@@ -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
|
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>
|
data/doc/index.html
CHANGED
@@ -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
|
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
|
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>
|
data/lib/lazier.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
@
|
150
|
+
@i18n.present?
|
150
151
|
end
|
151
152
|
end
|
data/lib/lazier/settings.rb
CHANGED
@@ -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
|
|
data/lib/lazier/version.rb
CHANGED
data/locales/en.yml
CHANGED
@@ -5,49 +5,50 @@
|
|
5
5
|
#
|
6
6
|
|
7
7
|
---
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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"
|
data/locales/it.yml
CHANGED
@@ -5,48 +5,49 @@
|
|
5
5
|
#
|
6
6
|
|
7
7
|
---
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
data/spec/lazier_spec.rb
CHANGED
@@ -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(:@
|
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
|
67
|
-
R18n.should_receive(:
|
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(:
|
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(:@
|
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
|