lazier 3.5.7 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis-gemfile +5 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +65 -8
- data/Gemfile +9 -8
- data/README.md +4 -0
- data/doc/Lazier.html +178 -110
- data/doc/Lazier/Boolean.html +7 -7
- data/doc/Lazier/Configuration.html +24 -50
- data/doc/Lazier/DateTime.html +50 -305
- data/doc/Lazier/DateTime/ClassMethods.html +116 -806
- data/doc/Lazier/Exceptions.html +2 -2
- data/doc/Lazier/Exceptions/Debug.html +1 -1
- data/doc/Lazier/Exceptions/MissingTranslation.html +18 -14
- data/doc/Lazier/Exceptions/TranslationExceptionHandler.html +213 -0
- data/doc/Lazier/Hash.html +19 -155
- data/doc/Lazier/I18n.html +1735 -230
- data/doc/Lazier/Math.html +1 -1
- data/doc/Lazier/Math/ClassMethods.html +13 -13
- data/doc/Lazier/Object.html +353 -339
- data/doc/Lazier/Pathname.html +4 -4
- data/doc/Lazier/Settings.html +150 -304
- data/doc/Lazier/String.html +39 -199
- data/doc/Lazier/TimeZone.html +244 -746
- data/doc/Lazier/TimeZone/ClassMethods.html +109 -127
- data/doc/Lazier/Version.html +4 -4
- data/doc/_index.html +15 -15
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +5 -1
- data/doc/index.html +5 -1
- data/doc/method_list.html +97 -169
- data/doc/top-level-namespace.html +1 -1
- data/lazier.gemspec +9 -6
- data/lib/lazier.rb +41 -50
- data/lib/lazier/boolean.rb +0 -1
- data/lib/lazier/configuration.rb +26 -28
- data/lib/lazier/datetime.rb +33 -127
- data/lib/lazier/exceptions.rb +14 -6
- data/lib/lazier/hash.rb +7 -15
- data/lib/lazier/i18n.rb +130 -48
- data/lib/lazier/math.rb +6 -7
- data/lib/lazier/object.rb +79 -97
- data/lib/lazier/pathname.rb +0 -1
- data/lib/lazier/settings.rb +12 -25
- data/lib/lazier/string.rb +17 -38
- data/lib/lazier/timezone.rb +168 -164
- data/lib/lazier/version.rb +3 -4
- data/locales/en.yml +52 -51
- data/locales/it.yml +51 -50
- data/spec/coverage_helper.rb +0 -1
- data/spec/lazier/boolean_spec.rb +2 -3
- data/spec/lazier/configuration_spec.rb +3 -5
- data/spec/lazier/datetime_spec.rb +34 -95
- data/spec/lazier/exceptions_spec.rb +25 -0
- data/spec/lazier/hash_spec.rb +0 -21
- data/spec/lazier/i18n_spec.rb +135 -51
- data/spec/lazier/math_spec.rb +0 -1
- data/spec/lazier/object_spec.rb +105 -100
- data/spec/lazier/pathname_spec.rb +0 -1
- data/spec/lazier/settings_spec.rb +25 -28
- data/spec/lazier/string_spec.rb +7 -20
- data/spec/lazier/timezone_spec.rb +101 -87
- data/spec/lazier_spec.rb +25 -8
- data/spec/spec_helper.rb +3 -2
- metadata +15 -44
- data/doc/Lazier/Localizer.html +0 -545
- data/lib/lazier/localizer.rb +0 -41
- data/spec/lazier/localizer_spec.rb +0 -45
data/doc/Lazier/Pathname.html
CHANGED
@@ -193,12 +193,12 @@ Pathname.new("/usr/bin/ruby").components
|
|
193
193
|
<pre class="lines">
|
194
194
|
|
195
195
|
|
196
|
+
19
|
196
197
|
20
|
197
|
-
21
|
198
|
-
22</pre>
|
198
|
+
21</pre>
|
199
199
|
</td>
|
200
200
|
<td>
|
201
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/pathname.rb', line
|
201
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/pathname.rb', line 19</span>
|
202
202
|
|
203
203
|
<span class='kw'>def</span> <span class='id identifier rubyid_components'>components</span>
|
204
204
|
<span class='id identifier rubyid_each_filename'>each_filename</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span>
|
@@ -213,7 +213,7 @@ Pathname.new("/usr/bin/ruby").components
|
|
213
213
|
</div>
|
214
214
|
|
215
215
|
<div id="footer">
|
216
|
-
Generated on
|
216
|
+
Generated on Sun Jun 1 15:50:06 2014 by
|
217
217
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
218
218
|
0.8.7.4 (ruby-2.1.2).
|
219
219
|
</div>
|
data/doc/Lazier/Settings.html
CHANGED
@@ -90,15 +90,11 @@
|
|
90
90
|
|
91
91
|
|
92
92
|
|
93
|
-
<dt class="r2">Includes:</dt>
|
94
|
-
<dd class="r2"><span class='object_link'><a href="I18n.html" title="Lazier::I18n (module)">I18n</a></span></dd>
|
95
|
-
|
96
|
-
|
97
93
|
|
98
94
|
|
99
95
|
|
100
|
-
<dt class="
|
101
|
-
<dd class="
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/lazier/settings.rb</dd>
|
102
98
|
|
103
99
|
</dl>
|
104
100
|
<div class="clear"></div>
|
@@ -244,6 +240,8 @@
|
|
244
240
|
|
245
241
|
|
246
242
|
|
243
|
+
<span class="note title readonly">readonly</span>
|
244
|
+
|
247
245
|
|
248
246
|
|
249
247
|
|
@@ -262,11 +260,6 @@
|
|
262
260
|
|
263
261
|
|
264
262
|
|
265
|
-
|
266
|
-
|
267
|
-
<h3 class="inherited">Attributes included from <span class='object_link'><a href="I18n.html" title="Lazier::I18n (module)">I18n</a></span></h3>
|
268
|
-
<p class="inherited"><span class='object_link'><a href="I18n.html#i18n_locale-instance_method" title="Lazier::I18n#i18n_locale (method)">#i18n_locale</a></span>, <span class='object_link'><a href="I18n.html#i18n_locales_path-instance_method" title="Lazier::I18n#i18n_locales_path (method)">#i18n_locales_path</a></span>, <span class='object_link'><a href="I18n.html#i18n_root-instance_method" title="Lazier::I18n#i18n_root (method)">#i18n_root</a></span></p>
|
269
|
-
|
270
263
|
|
271
264
|
|
272
265
|
<h2>
|
@@ -359,7 +352,7 @@
|
|
359
352
|
<li class="public ">
|
360
353
|
<span class="summary_signature">
|
361
354
|
|
362
|
-
<a href="#setup_boolean_names-instance_method" title="#setup_boolean_names (instance method)">- (Hash) <strong>setup_boolean_names</strong>(true_name
|
355
|
+
<a href="#setup_boolean_names-instance_method" title="#setup_boolean_names (instance method)">- (Hash) <strong>setup_boolean_names</strong>(true_name: nil, false_name: nil) </a>
|
363
356
|
|
364
357
|
|
365
358
|
|
@@ -405,7 +398,7 @@
|
|
405
398
|
<li class="public ">
|
406
399
|
<span class="summary_signature">
|
407
400
|
|
408
|
-
<a href="#setup_date_names-instance_method" title="#setup_date_names (instance method)">- (Hash) <strong>setup_date_names</strong>(long_months
|
401
|
+
<a href="#setup_date_names-instance_method" title="#setup_date_names (instance method)">- (Hash) <strong>setup_date_names</strong>(long_months: nil, short_months: nil, long_days: nil, short_days: nil) </a>
|
409
402
|
|
410
403
|
|
411
404
|
|
@@ -428,7 +421,7 @@
|
|
428
421
|
<li class="public ">
|
429
422
|
<span class="summary_signature">
|
430
423
|
|
431
|
-
<a href="#setup_format_number-instance_method" title="#setup_format_number (instance method)">- (Hash) <strong>setup_format_number</strong>(precision
|
424
|
+
<a href="#setup_format_number-instance_method" title="#setup_format_number (instance method)">- (Hash) <strong>setup_format_number</strong>(precision: 2, decimal_separator: ".", add_string: nil, k_separator: ",") </a>
|
432
425
|
|
433
426
|
|
434
427
|
|
@@ -451,17 +444,6 @@
|
|
451
444
|
</ul>
|
452
445
|
|
453
446
|
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="I18n.html" title="Lazier::I18n (module)">I18n</a></span></h3>
|
464
|
-
<p class="inherited"><span class='object_link'><a href="I18n.html#i18n_setup-instance_method" title="Lazier::I18n#i18n_setup (method)">#i18n_setup</a></span></p>
|
465
447
|
<div id="constructor_details" class="method_details_list">
|
466
448
|
<h2>Constructor Details</h2>
|
467
449
|
|
@@ -490,16 +472,16 @@
|
|
490
472
|
<pre class="lines">
|
491
473
|
|
492
474
|
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
475
|
+
32
|
476
|
+
33
|
477
|
+
34
|
478
|
+
35</pre>
|
497
479
|
</td>
|
498
480
|
<td>
|
499
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
481
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 32</span>
|
500
482
|
|
501
483
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
502
|
-
<span class='
|
484
|
+
<span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
503
485
|
<span class='id identifier rubyid_setup'>setup</span>
|
504
486
|
<span class='kw'>end</span></pre>
|
505
487
|
</td>
|
@@ -556,6 +538,7 @@
|
|
556
538
|
<pre class="lines">
|
557
539
|
|
558
540
|
|
541
|
+
19
|
559
542
|
20
|
560
543
|
21
|
561
544
|
22
|
@@ -642,31 +625,13 @@
|
|
642
625
|
103
|
643
626
|
104
|
644
627
|
105
|
645
|
-
106
|
646
|
-
107
|
647
|
-
108
|
648
|
-
109
|
649
|
-
110
|
650
|
-
111
|
651
|
-
112
|
652
|
-
113
|
653
|
-
114
|
654
|
-
115
|
655
|
-
116
|
656
|
-
117
|
657
|
-
118
|
658
|
-
119</pre>
|
628
|
+
106</pre>
|
659
629
|
</td>
|
660
630
|
<td>
|
661
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
631
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>
|
662
632
|
|
663
633
|
<span class='kw'>class</span> <span class='const'>Settings</span>
|
664
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
|
665
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
|
666
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
|
667
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
|
668
|
-
|
669
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
|
634
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>
|
670
635
|
|
671
636
|
<span class='comment'># Returns the singleton instance of the settings.
|
672
637
|
</span> <span class='comment'>#
|
@@ -674,12 +639,12 @@
|
|
674
639
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
675
640
|
</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>
|
676
641
|
<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>
|
677
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
642
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
|
678
643
|
<span class='kw'>end</span>
|
679
644
|
|
680
645
|
<span class='comment'># Initializes a new settings object.
|
681
646
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
682
|
-
<span class='
|
647
|
+
<span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
683
648
|
<span class='id identifier rubyid_setup'>setup</span>
|
684
649
|
<span class='kw'>end</span>
|
685
650
|
|
@@ -691,15 +656,6 @@
|
|
691
656
|
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
692
657
|
<span class='kw'>end</span>
|
693
658
|
|
694
|
-
<span class='comment'># Set the current locale for messages.
|
695
|
-
</span> <span class='comment'>#
|
696
|
-
</span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
|
697
|
-
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
698
|
-
</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>
|
699
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
700
|
-
<span class='id identifier rubyid_setup'>setup</span>
|
701
|
-
<span class='kw'>end</span>
|
702
|
-
|
703
659
|
<span class='comment'># Setups formatters for a number.
|
704
660
|
</span> <span class='comment'># @see Object#format_number
|
705
661
|
</span> <span class='comment'>#
|
@@ -708,7 +664,7 @@
|
|
708
664
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
709
665
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
710
666
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
711
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='
|
667
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
712
668
|
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
713
669
|
<span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
|
714
670
|
<span class='rparen'>)</span>
|
@@ -720,8 +676,9 @@
|
|
720
676
|
</span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
|
721
677
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
722
678
|
</span> <span class='comment'># @return [Hash] The new representations.
|
723
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='
|
724
|
-
<span class='
|
679
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
680
|
+
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>boolean</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
681
|
+
<span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=></span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
725
682
|
<span class='kw'>end</span>
|
726
683
|
|
727
684
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -733,7 +690,8 @@
|
|
733
690
|
</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>
|
734
691
|
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>
|
735
692
|
|
736
|
-
<span class='
|
693
|
+
<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'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
694
|
+
<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>
|
737
695
|
<span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>
|
738
696
|
|
739
697
|
<span class='ivar'>@date_formats</span>
|
@@ -749,15 +707,15 @@
|
|
749
707
|
</span> <span class='comment'># @param long_days [Array] The string representation of days.
|
750
708
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
751
709
|
</span> <span class='comment'># @return [Hash] The new representations.
|
752
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='
|
753
|
-
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier
|
710
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
711
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>date</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
754
712
|
|
755
713
|
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
756
714
|
<span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
757
715
|
<span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
758
716
|
<span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
|
759
717
|
<span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
|
760
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier
|
718
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
761
719
|
<span class='kw'>end</span>
|
762
720
|
<span class='kw'>end</span></pre>
|
763
721
|
</td>
|
@@ -809,6 +767,7 @@
|
|
809
767
|
<pre class="lines">
|
810
768
|
|
811
769
|
|
770
|
+
19
|
812
771
|
20
|
813
772
|
21
|
814
773
|
22
|
@@ -895,31 +854,13 @@
|
|
895
854
|
103
|
896
855
|
104
|
897
856
|
105
|
898
|
-
106
|
899
|
-
107
|
900
|
-
108
|
901
|
-
109
|
902
|
-
110
|
903
|
-
111
|
904
|
-
112
|
905
|
-
113
|
906
|
-
114
|
907
|
-
115
|
908
|
-
116
|
909
|
-
117
|
910
|
-
118
|
911
|
-
119</pre>
|
857
|
+
106</pre>
|
912
858
|
</td>
|
913
859
|
<td>
|
914
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
860
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>
|
915
861
|
|
916
862
|
<span class='kw'>class</span> <span class='const'>Settings</span>
|
917
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
|
918
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
|
919
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
|
920
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
|
921
|
-
|
922
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
|
863
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>
|
923
864
|
|
924
865
|
<span class='comment'># Returns the singleton instance of the settings.
|
925
866
|
</span> <span class='comment'>#
|
@@ -927,12 +868,12 @@
|
|
927
868
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
928
869
|
</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>
|
929
870
|
<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>
|
930
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
871
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
|
931
872
|
<span class='kw'>end</span>
|
932
873
|
|
933
874
|
<span class='comment'># Initializes a new settings object.
|
934
875
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
935
|
-
<span class='
|
876
|
+
<span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
936
877
|
<span class='id identifier rubyid_setup'>setup</span>
|
937
878
|
<span class='kw'>end</span>
|
938
879
|
|
@@ -944,15 +885,6 @@
|
|
944
885
|
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
945
886
|
<span class='kw'>end</span>
|
946
887
|
|
947
|
-
<span class='comment'># Set the current locale for messages.
|
948
|
-
</span> <span class='comment'>#
|
949
|
-
</span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
|
950
|
-
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
951
|
-
</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>
|
952
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
953
|
-
<span class='id identifier rubyid_setup'>setup</span>
|
954
|
-
<span class='kw'>end</span>
|
955
|
-
|
956
888
|
<span class='comment'># Setups formatters for a number.
|
957
889
|
</span> <span class='comment'># @see Object#format_number
|
958
890
|
</span> <span class='comment'>#
|
@@ -961,7 +893,7 @@
|
|
961
893
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
962
894
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
963
895
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
964
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='
|
896
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
965
897
|
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
966
898
|
<span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
|
967
899
|
<span class='rparen'>)</span>
|
@@ -973,8 +905,9 @@
|
|
973
905
|
</span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
|
974
906
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
975
907
|
</span> <span class='comment'># @return [Hash] The new representations.
|
976
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='
|
977
|
-
<span class='
|
908
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
909
|
+
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>boolean</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
910
|
+
<span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=></span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
978
911
|
<span class='kw'>end</span>
|
979
912
|
|
980
913
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -986,7 +919,8 @@
|
|
986
919
|
</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>
|
987
920
|
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>
|
988
921
|
|
989
|
-
<span class='
|
922
|
+
<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'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
923
|
+
<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>
|
990
924
|
<span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>
|
991
925
|
|
992
926
|
<span class='ivar'>@date_formats</span>
|
@@ -1002,15 +936,15 @@
|
|
1002
936
|
</span> <span class='comment'># @param long_days [Array] The string representation of days.
|
1003
937
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
1004
938
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1005
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='
|
1006
|
-
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier
|
939
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
940
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>date</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
1007
941
|
|
1008
942
|
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1009
943
|
<span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1010
944
|
<span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1011
945
|
<span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1012
946
|
<span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
|
1013
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier
|
947
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
1014
948
|
<span class='kw'>end</span>
|
1015
949
|
<span class='kw'>end</span></pre>
|
1016
950
|
</td>
|
@@ -1062,6 +996,7 @@
|
|
1062
996
|
<pre class="lines">
|
1063
997
|
|
1064
998
|
|
999
|
+
19
|
1065
1000
|
20
|
1066
1001
|
21
|
1067
1002
|
22
|
@@ -1148,31 +1083,13 @@
|
|
1148
1083
|
103
|
1149
1084
|
104
|
1150
1085
|
105
|
1151
|
-
106
|
1152
|
-
107
|
1153
|
-
108
|
1154
|
-
109
|
1155
|
-
110
|
1156
|
-
111
|
1157
|
-
112
|
1158
|
-
113
|
1159
|
-
114
|
1160
|
-
115
|
1161
|
-
116
|
1162
|
-
117
|
1163
|
-
118
|
1164
|
-
119</pre>
|
1086
|
+
106</pre>
|
1165
1087
|
</td>
|
1166
1088
|
<td>
|
1167
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
1089
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>
|
1168
1090
|
|
1169
1091
|
<span class='kw'>class</span> <span class='const'>Settings</span>
|
1170
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
|
1171
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
|
1172
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
|
1173
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
|
1174
|
-
|
1175
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
|
1092
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>
|
1176
1093
|
|
1177
1094
|
<span class='comment'># Returns the singleton instance of the settings.
|
1178
1095
|
</span> <span class='comment'>#
|
@@ -1180,12 +1097,12 @@
|
|
1180
1097
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
1181
1098
|
</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>
|
1182
1099
|
<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>
|
1183
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1100
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
|
1184
1101
|
<span class='kw'>end</span>
|
1185
1102
|
|
1186
1103
|
<span class='comment'># Initializes a new settings object.
|
1187
1104
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
1188
|
-
<span class='
|
1105
|
+
<span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
1189
1106
|
<span class='id identifier rubyid_setup'>setup</span>
|
1190
1107
|
<span class='kw'>end</span>
|
1191
1108
|
|
@@ -1197,15 +1114,6 @@
|
|
1197
1114
|
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
1198
1115
|
<span class='kw'>end</span>
|
1199
1116
|
|
1200
|
-
<span class='comment'># Set the current locale for messages.
|
1201
|
-
</span> <span class='comment'>#
|
1202
|
-
</span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
|
1203
|
-
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
1204
|
-
</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>
|
1205
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
1206
|
-
<span class='id identifier rubyid_setup'>setup</span>
|
1207
|
-
<span class='kw'>end</span>
|
1208
|
-
|
1209
1117
|
<span class='comment'># Setups formatters for a number.
|
1210
1118
|
</span> <span class='comment'># @see Object#format_number
|
1211
1119
|
</span> <span class='comment'>#
|
@@ -1214,7 +1122,7 @@
|
|
1214
1122
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
1215
1123
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
1216
1124
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
1217
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='
|
1125
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1218
1126
|
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1219
1127
|
<span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
|
1220
1128
|
<span class='rparen'>)</span>
|
@@ -1226,8 +1134,9 @@
|
|
1226
1134
|
</span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
|
1227
1135
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
1228
1136
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1229
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='
|
1230
|
-
<span class='
|
1137
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1138
|
+
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>boolean</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1139
|
+
<span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=></span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1231
1140
|
<span class='kw'>end</span>
|
1232
1141
|
|
1233
1142
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -1239,7 +1148,8 @@
|
|
1239
1148
|
</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>
|
1240
1149
|
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>
|
1241
1150
|
|
1242
|
-
<span class='
|
1151
|
+
<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'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
1152
|
+
<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>
|
1243
1153
|
<span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>
|
1244
1154
|
|
1245
1155
|
<span class='ivar'>@date_formats</span>
|
@@ -1255,15 +1165,15 @@
|
|
1255
1165
|
</span> <span class='comment'># @param long_days [Array] The string representation of days.
|
1256
1166
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
1257
1167
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1258
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='
|
1259
|
-
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier
|
1168
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1169
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>date</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
1260
1170
|
|
1261
1171
|
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1262
1172
|
<span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1263
1173
|
<span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1264
1174
|
<span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1265
1175
|
<span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
|
1266
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier
|
1176
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
1267
1177
|
<span class='kw'>end</span>
|
1268
1178
|
<span class='kw'>end</span></pre>
|
1269
1179
|
</td>
|
@@ -1315,6 +1225,7 @@
|
|
1315
1225
|
<pre class="lines">
|
1316
1226
|
|
1317
1227
|
|
1228
|
+
19
|
1318
1229
|
20
|
1319
1230
|
21
|
1320
1231
|
22
|
@@ -1401,31 +1312,13 @@
|
|
1401
1312
|
103
|
1402
1313
|
104
|
1403
1314
|
105
|
1404
|
-
106
|
1405
|
-
107
|
1406
|
-
108
|
1407
|
-
109
|
1408
|
-
110
|
1409
|
-
111
|
1410
|
-
112
|
1411
|
-
113
|
1412
|
-
114
|
1413
|
-
115
|
1414
|
-
116
|
1415
|
-
117
|
1416
|
-
118
|
1417
|
-
119</pre>
|
1315
|
+
106</pre>
|
1418
1316
|
</td>
|
1419
1317
|
<td>
|
1420
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
1318
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>
|
1421
1319
|
|
1422
1320
|
<span class='kw'>class</span> <span class='const'>Settings</span>
|
1423
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
|
1424
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
|
1425
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
|
1426
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
|
1427
|
-
|
1428
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
|
1321
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>
|
1429
1322
|
|
1430
1323
|
<span class='comment'># Returns the singleton instance of the settings.
|
1431
1324
|
</span> <span class='comment'>#
|
@@ -1433,12 +1326,12 @@
|
|
1433
1326
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
1434
1327
|
</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>
|
1435
1328
|
<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>
|
1436
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1329
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
|
1437
1330
|
<span class='kw'>end</span>
|
1438
1331
|
|
1439
1332
|
<span class='comment'># Initializes a new settings object.
|
1440
1333
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
1441
|
-
<span class='
|
1334
|
+
<span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
1442
1335
|
<span class='id identifier rubyid_setup'>setup</span>
|
1443
1336
|
<span class='kw'>end</span>
|
1444
1337
|
|
@@ -1450,15 +1343,6 @@
|
|
1450
1343
|
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
1451
1344
|
<span class='kw'>end</span>
|
1452
1345
|
|
1453
|
-
<span class='comment'># Set the current locale for messages.
|
1454
|
-
</span> <span class='comment'>#
|
1455
|
-
</span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
|
1456
|
-
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
1457
|
-
</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>
|
1458
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
1459
|
-
<span class='id identifier rubyid_setup'>setup</span>
|
1460
|
-
<span class='kw'>end</span>
|
1461
|
-
|
1462
1346
|
<span class='comment'># Setups formatters for a number.
|
1463
1347
|
</span> <span class='comment'># @see Object#format_number
|
1464
1348
|
</span> <span class='comment'>#
|
@@ -1467,7 +1351,7 @@
|
|
1467
1351
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
1468
1352
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
1469
1353
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
1470
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='
|
1354
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1471
1355
|
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1472
1356
|
<span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
|
1473
1357
|
<span class='rparen'>)</span>
|
@@ -1479,8 +1363,9 @@
|
|
1479
1363
|
</span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
|
1480
1364
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
1481
1365
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1482
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='
|
1483
|
-
<span class='
|
1366
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1367
|
+
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>boolean</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1368
|
+
<span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=></span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1484
1369
|
<span class='kw'>end</span>
|
1485
1370
|
|
1486
1371
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -1492,7 +1377,8 @@
|
|
1492
1377
|
</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>
|
1493
1378
|
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>
|
1494
1379
|
|
1495
|
-
<span class='
|
1380
|
+
<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'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
1381
|
+
<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>
|
1496
1382
|
<span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>
|
1497
1383
|
|
1498
1384
|
<span class='ivar'>@date_formats</span>
|
@@ -1508,15 +1394,15 @@
|
|
1508
1394
|
</span> <span class='comment'># @param long_days [Array] The string representation of days.
|
1509
1395
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
1510
1396
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1511
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='
|
1512
|
-
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier
|
1397
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1398
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>date</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
1513
1399
|
|
1514
1400
|
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1515
1401
|
<span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1516
1402
|
<span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1517
1403
|
<span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1518
1404
|
<span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
|
1519
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier
|
1405
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
1520
1406
|
<span class='kw'>end</span>
|
1521
1407
|
<span class='kw'>end</span></pre>
|
1522
1408
|
</td>
|
@@ -1525,11 +1411,11 @@
|
|
1525
1411
|
</div>
|
1526
1412
|
|
1527
1413
|
|
1528
|
-
<span id="
|
1414
|
+
<span id=""></span>
|
1529
1415
|
<div class="method_details ">
|
1530
1416
|
<h3 class="signature " id="i18n-instance_method">
|
1531
1417
|
|
1532
|
-
- (<tt>R18n::Translation</tt>) <strong>i18n</strong>
|
1418
|
+
- (<tt>R18n::Translation</tt>) <strong>i18n</strong> <span class="extras">(readonly)</span>
|
1533
1419
|
|
1534
1420
|
|
1535
1421
|
|
@@ -1568,6 +1454,7 @@
|
|
1568
1454
|
<pre class="lines">
|
1569
1455
|
|
1570
1456
|
|
1457
|
+
19
|
1571
1458
|
20
|
1572
1459
|
21
|
1573
1460
|
22
|
@@ -1654,31 +1541,13 @@
|
|
1654
1541
|
103
|
1655
1542
|
104
|
1656
1543
|
105
|
1657
|
-
106
|
1658
|
-
107
|
1659
|
-
108
|
1660
|
-
109
|
1661
|
-
110
|
1662
|
-
111
|
1663
|
-
112
|
1664
|
-
113
|
1665
|
-
114
|
1666
|
-
115
|
1667
|
-
116
|
1668
|
-
117
|
1669
|
-
118
|
1670
|
-
119</pre>
|
1544
|
+
106</pre>
|
1671
1545
|
</td>
|
1672
1546
|
<td>
|
1673
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
1547
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 19</span>
|
1674
1548
|
|
1675
1549
|
<span class='kw'>class</span> <span class='const'>Settings</span>
|
1676
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span>
|
1677
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:boolean_names</span>
|
1678
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_names</span>
|
1679
|
-
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:date_formats</span>
|
1680
|
-
|
1681
|
-
<span class='id identifier rubyid_include'>include</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span>
|
1550
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:format_number</span><span class='comma'>,</span> <span class='symbol'>:boolean_names</span><span class='comma'>,</span> <span class='symbol'>:date_names</span><span class='comma'>,</span> <span class='symbol'>:date_formats</span><span class='comma'>,</span> <span class='symbol'>:i18n</span>
|
1682
1551
|
|
1683
1552
|
<span class='comment'># Returns the singleton instance of the settings.
|
1684
1553
|
</span> <span class='comment'>#
|
@@ -1686,12 +1555,12 @@
|
|
1686
1555
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
1687
1556
|
</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>
|
1688
1557
|
<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>
|
1689
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1558
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
|
1690
1559
|
<span class='kw'>end</span>
|
1691
1560
|
|
1692
1561
|
<span class='comment'># Initializes a new settings object.
|
1693
1562
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
1694
|
-
<span class='
|
1563
|
+
<span class='ivar'>@i18n</span> <span class='op'>=</span> <span class='const'>Lazier</span><span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
|
1695
1564
|
<span class='id identifier rubyid_setup'>setup</span>
|
1696
1565
|
<span class='kw'>end</span>
|
1697
1566
|
|
@@ -1703,15 +1572,6 @@
|
|
1703
1572
|
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
1704
1573
|
<span class='kw'>end</span>
|
1705
1574
|
|
1706
|
-
<span class='comment'># Set the current locale for messages.
|
1707
|
-
</span> <span class='comment'>#
|
1708
|
-
</span> <span class='comment'># @param locale [String] The new locale. Default is the current system locale.
|
1709
|
-
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
1710
|
-
</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>
|
1711
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
1712
|
-
<span class='id identifier rubyid_setup'>setup</span>
|
1713
|
-
<span class='kw'>end</span>
|
1714
|
-
|
1715
1575
|
<span class='comment'># Setups formatters for a number.
|
1716
1576
|
</span> <span class='comment'># @see Object#format_number
|
1717
1577
|
</span> <span class='comment'>#
|
@@ -1720,7 +1580,7 @@
|
|
1720
1580
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
1721
1581
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
1722
1582
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
1723
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='
|
1583
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1724
1584
|
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
1725
1585
|
<span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
|
1726
1586
|
<span class='rparen'>)</span>
|
@@ -1732,8 +1592,9 @@
|
|
1732
1592
|
</span> <span class='comment'># @param true_name [String] The string representation of `true`. Defaults to `Yes`.
|
1733
1593
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
1734
1594
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1735
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='
|
1736
|
-
<span class='
|
1595
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1596
|
+
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>boolean</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1597
|
+
<span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=></span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1737
1598
|
<span class='kw'>end</span>
|
1738
1599
|
|
1739
1600
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -1745,7 +1606,8 @@
|
|
1745
1606
|
</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>
|
1746
1607
|
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>
|
1747
1608
|
|
1748
|
-
<span class='
|
1609
|
+
<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'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
1610
|
+
<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>
|
1749
1611
|
<span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>
|
1750
1612
|
|
1751
1613
|
<span class='ivar'>@date_formats</span>
|
@@ -1761,15 +1623,15 @@
|
|
1761
1623
|
</span> <span class='comment'># @param long_days [Array] The string representation of days.
|
1762
1624
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
1763
1625
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1764
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='
|
1765
|
-
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier
|
1626
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1627
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>date</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
1766
1628
|
|
1767
1629
|
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1768
1630
|
<span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1769
1631
|
<span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1770
1632
|
<span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
|
1771
1633
|
<span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
|
1772
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier
|
1634
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
1773
1635
|
<span class='kw'>end</span>
|
1774
1636
|
<span class='kw'>end</span></pre>
|
1775
1637
|
</td>
|
@@ -1847,17 +1709,17 @@
|
|
1847
1709
|
<pre class="lines">
|
1848
1710
|
|
1849
1711
|
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1712
|
+
26
|
1713
|
+
27
|
1714
|
+
28
|
1715
|
+
29</pre>
|
1854
1716
|
</td>
|
1855
1717
|
<td>
|
1856
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
1718
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 26</span>
|
1857
1719
|
|
1858
1720
|
<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>
|
1859
1721
|
<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>
|
1860
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1722
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='id identifier rubyid_new'>new</span>
|
1861
1723
|
<span class='kw'>end</span></pre>
|
1862
1724
|
</td>
|
1863
1725
|
</tr>
|
@@ -1895,15 +1757,15 @@
|
|
1895
1757
|
<pre class="lines">
|
1896
1758
|
|
1897
1759
|
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1760
|
+
38
|
1761
|
+
39
|
1762
|
+
40
|
1763
|
+
41
|
1764
|
+
42
|
1765
|
+
43</pre>
|
1904
1766
|
</td>
|
1905
1767
|
<td>
|
1906
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
1768
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 38</span>
|
1907
1769
|
|
1908
1770
|
<span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
|
1909
1771
|
<span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
|
@@ -1919,7 +1781,7 @@
|
|
1919
1781
|
<div class="method_details ">
|
1920
1782
|
<h3 class="signature " id="setup_boolean_names-instance_method">
|
1921
1783
|
|
1922
|
-
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>setup_boolean_names</strong>(true_name
|
1784
|
+
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>setup_boolean_names</strong>(true_name: nil, false_name: nil)
|
1923
1785
|
|
1924
1786
|
|
1925
1787
|
|
@@ -1944,8 +1806,6 @@
|
|
1944
1806
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1945
1807
|
|
1946
1808
|
|
1947
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1948
|
-
|
1949
1809
|
|
1950
1810
|
—
|
1951
1811
|
<div class='inline'><p>The string representation of <code>true</code>. Defaults to <code>Yes</code>.</p>
|
@@ -1961,8 +1821,6 @@
|
|
1961
1821
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1962
1822
|
|
1963
1823
|
|
1964
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1965
|
-
|
1966
1824
|
|
1967
1825
|
—
|
1968
1826
|
<div class='inline'><p>The string representation of <code>false</code>. Defaults to <code>No</code>.</p>
|
@@ -2003,15 +1861,17 @@
|
|
2003
1861
|
<pre class="lines">
|
2004
1862
|
|
2005
1863
|
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
1864
|
+
65
|
1865
|
+
66
|
1866
|
+
67
|
1867
|
+
68</pre>
|
2009
1868
|
</td>
|
2010
1869
|
<td>
|
2011
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
1870
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 65</span>
|
2012
1871
|
|
2013
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='
|
2014
|
-
<span class='
|
1872
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='label'>true_name:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>false_name:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1873
|
+
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>boolean</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1874
|
+
<span class='ivar'>@boolean_names</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='kw'>true</span> <span class='op'>=></span> <span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||</span> <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
2015
1875
|
<span class='kw'>end</span></pre>
|
2016
1876
|
</td>
|
2017
1877
|
</tr>
|
@@ -2095,7 +1955,7 @@
|
|
2095
1955
|
<p class="tag_title">See Also:</p>
|
2096
1956
|
<ul class="see">
|
2097
1957
|
|
2098
|
-
<li
|
1958
|
+
<li>DateTime#lstrftime</li>
|
2099
1959
|
|
2100
1960
|
</ul>
|
2101
1961
|
|
@@ -2105,22 +1965,24 @@
|
|
2105
1965
|
<pre class="lines">
|
2106
1966
|
|
2107
1967
|
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
1968
|
+
76
|
1969
|
+
77
|
1970
|
+
78
|
1971
|
+
79
|
1972
|
+
80
|
1973
|
+
81
|
1974
|
+
82
|
1975
|
+
83
|
1976
|
+
84</pre>
|
2116
1977
|
</td>
|
2117
1978
|
<td>
|
2118
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
1979
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 76</span>
|
2119
1980
|
|
2120
1981
|
<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>
|
2121
1982
|
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>||</span> <span class='op'>!</span><span class='ivar'>@date_formats</span>
|
2122
1983
|
|
2123
|
-
<span class='
|
1984
|
+
<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'>unless</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
1985
|
+
<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>
|
2124
1986
|
<span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@date_formats</span><span class='rparen'>)</span>
|
2125
1987
|
|
2126
1988
|
<span class='ivar'>@date_formats</span>
|
@@ -2133,7 +1995,7 @@
|
|
2133
1995
|
<div class="method_details ">
|
2134
1996
|
<h3 class="signature " id="setup_date_names-instance_method">
|
2135
1997
|
|
2136
|
-
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>setup_date_names</strong>(long_months
|
1998
|
+
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>setup_date_names</strong>(long_months: nil, short_months: nil, long_days: nil, short_days: nil)
|
2137
1999
|
|
2138
2000
|
|
2139
2001
|
|
@@ -2158,8 +2020,6 @@
|
|
2158
2020
|
<span class='type'>(<tt>Array</tt>)</span>
|
2159
2021
|
|
2160
2022
|
|
2161
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2162
|
-
|
2163
2023
|
|
2164
2024
|
—
|
2165
2025
|
<div class='inline'><p>The string representation of months.</p>
|
@@ -2175,8 +2035,6 @@
|
|
2175
2035
|
<span class='type'>(<tt>Array</tt>)</span>
|
2176
2036
|
|
2177
2037
|
|
2178
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2179
|
-
|
2180
2038
|
|
2181
2039
|
—
|
2182
2040
|
<div class='inline'><p>The abbreviated string representation of months.</p>
|
@@ -2192,8 +2050,6 @@
|
|
2192
2050
|
<span class='type'>(<tt>Array</tt>)</span>
|
2193
2051
|
|
2194
2052
|
|
2195
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2196
|
-
|
2197
2053
|
|
2198
2054
|
—
|
2199
2055
|
<div class='inline'><p>The string representation of days.</p>
|
@@ -2209,8 +2065,6 @@
|
|
2209
2065
|
<span class='type'>(<tt>Array</tt>)</span>
|
2210
2066
|
|
2211
2067
|
|
2212
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2213
|
-
|
2214
2068
|
|
2215
2069
|
—
|
2216
2070
|
<div class='inline'><p>The abbreviated string representation of days.</p>
|
@@ -2245,7 +2099,7 @@
|
|
2245
2099
|
|
2246
2100
|
<li><span class='object_link'><a href="DateTime/ClassMethods.html#months-instance_method" title="Lazier::DateTime::ClassMethods#months (method)">DateTime::ClassMethods#months</a></span></li>
|
2247
2101
|
|
2248
|
-
<li
|
2102
|
+
<li>DateTime#lstrftime</li>
|
2249
2103
|
|
2250
2104
|
</ul>
|
2251
2105
|
|
@@ -2255,29 +2109,29 @@
|
|
2255
2109
|
<pre class="lines">
|
2256
2110
|
|
2257
2111
|
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2112
|
+
96
|
2113
|
+
97
|
2114
|
+
98
|
2115
|
+
99
|
2116
|
+
100
|
2117
|
+
101
|
2118
|
+
102
|
2119
|
+
103
|
2120
|
+
104
|
2121
|
+
105</pre>
|
2268
2122
|
</td>
|
2269
2123
|
<td>
|
2270
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
2124
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 96</span>
|
2271
2125
|
|
2272
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='
|
2273
|
-
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier
|
2126
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='label'>long_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_months:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>long_days:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>short_days:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2127
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_translate'>translate</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>date</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
2274
2128
|
|
2275
2129
|
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
2276
2130
|
<span class='label'>long_months:</span> <span class='id identifier rubyid_long_months'>long_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_months'>long_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
2277
2131
|
<span class='label'>short_months:</span> <span class='id identifier rubyid_short_months'>short_months</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_months'>short_months</span><span class='rparen'>)</span><span class='comma'>,</span>
|
2278
2132
|
<span class='label'>long_days:</span> <span class='id identifier rubyid_long_days'>long_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_long_days'>long_days</span><span class='rparen'>)</span><span class='comma'>,</span>
|
2279
2133
|
<span class='label'>short_days:</span> <span class='id identifier rubyid_short_days'>short_days</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_definitions'>definitions</span><span class='period'>.</span><span class='id identifier rubyid_short_days'>short_days</span><span class='rparen'>)</span>
|
2280
|
-
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier
|
2134
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='symbol'>:indifferent</span><span class='comma'>,</span> <span class='symbol'>:dotted</span><span class='rparen'>)</span>
|
2281
2135
|
<span class='kw'>end</span></pre>
|
2282
2136
|
</td>
|
2283
2137
|
</tr>
|
@@ -2287,7 +2141,7 @@
|
|
2287
2141
|
<div class="method_details ">
|
2288
2142
|
<h3 class="signature " id="setup_format_number-instance_method">
|
2289
2143
|
|
2290
|
-
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>setup_format_number</strong>(precision
|
2144
|
+
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>setup_format_number</strong>(precision: 2, decimal_separator: ".", add_string: nil, k_separator: ",")
|
2291
2145
|
|
2292
2146
|
|
2293
2147
|
|
@@ -2312,8 +2166,6 @@
|
|
2312
2166
|
<span class='type'>(<tt>Fixnum</tt>)</span>
|
2313
2167
|
|
2314
2168
|
|
2315
|
-
<em class="default">(defaults to: <tt>2</tt>)</em>
|
2316
|
-
|
2317
2169
|
|
2318
2170
|
—
|
2319
2171
|
<div class='inline'><p>The precision to show.</p>
|
@@ -2329,8 +2181,6 @@
|
|
2329
2181
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
2330
2182
|
|
2331
2183
|
|
2332
|
-
<em class="default">(defaults to: <tt>"."</tt>)</em>
|
2333
|
-
|
2334
2184
|
|
2335
2185
|
—
|
2336
2186
|
<div class='inline'><p>The string to use as decimal separator.</p>
|
@@ -2346,8 +2196,6 @@
|
|
2346
2196
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
2347
2197
|
|
2348
2198
|
|
2349
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2350
|
-
|
2351
2199
|
|
2352
2200
|
—
|
2353
2201
|
<div class='inline'><p>The string to append to the number.</p>
|
@@ -2363,8 +2211,6 @@
|
|
2363
2211
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
2364
2212
|
|
2365
2213
|
|
2366
|
-
<em class="default">(defaults to: <tt>","</tt>)</em>
|
2367
|
-
|
2368
2214
|
|
2369
2215
|
—
|
2370
2216
|
<div class='inline'><p>The string to use as thousands separator.</p>
|
@@ -2405,16 +2251,16 @@
|
|
2405
2251
|
<pre class="lines">
|
2406
2252
|
|
2407
2253
|
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2254
|
+
53
|
2255
|
+
54
|
2256
|
+
55
|
2257
|
+
56
|
2258
|
+
57</pre>
|
2413
2259
|
</td>
|
2414
2260
|
<td>
|
2415
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
2261
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 53</span>
|
2416
2262
|
|
2417
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='
|
2263
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='label'>precision:</span> <span class='int'>2</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2418
2264
|
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
2419
2265
|
<span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span>
|
2420
2266
|
<span class='rparen'>)</span>
|
@@ -2429,7 +2275,7 @@
|
|
2429
2275
|
</div>
|
2430
2276
|
|
2431
2277
|
<div id="footer">
|
2432
|
-
Generated on
|
2278
|
+
Generated on Sun Jun 1 15:50:06 2014 by
|
2433
2279
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2434
2280
|
0.8.7.4 (ruby-2.1.2).
|
2435
2281
|
</div>
|