lazier 2.8.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +3 -3
- data/doc/Lazier.html +69 -99
- data/doc/Lazier/Boolean.html +6 -6
- data/doc/Lazier/DateTime.html +35 -39
- data/doc/Lazier/DateTime/ClassMethods.html +59 -85
- data/doc/Lazier/Exceptions.html +6 -6
- data/doc/Lazier/Exceptions/Debug.html +133 -0
- data/doc/Lazier/Exceptions/MissingTranslation.html +8 -8
- data/doc/Lazier/Hash.html +5 -270
- data/doc/Lazier/I18n.html +68 -26
- data/doc/Lazier/Localizer.html +17 -21
- data/doc/Lazier/Math.html +5 -5
- data/doc/Lazier/Math/ClassMethods.html +5 -5
- data/doc/Lazier/Object.html +681 -218
- data/doc/Lazier/Pathname.html +7 -11
- data/doc/Lazier/Settings.html +166 -262
- data/doc/Lazier/String.html +21 -25
- data/doc/Lazier/TimeZone.html +119 -130
- data/doc/Lazier/TimeZone/ClassMethods.html +75 -83
- data/doc/Lazier/Version.html +8 -8
- data/doc/_index.html +7 -7
- data/doc/class_list.html +2 -2
- data/doc/file.README.html +5 -5
- data/doc/file_list.html +1 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +5 -5
- data/doc/js/full_list.js +6 -1
- data/doc/method_list.html +134 -324
- data/doc/top-level-namespace.html +5 -5
- data/lazier.gemspec +4 -3
- data/lib/lazier.rb +9 -23
- data/lib/lazier/boolean.rb +1 -1
- data/lib/lazier/datetime.rb +47 -79
- data/lib/lazier/exceptions.rb +4 -4
- data/lib/lazier/hash.rb +0 -24
- data/lib/lazier/i18n.rb +13 -6
- data/lib/lazier/localizer.rb +3 -5
- data/lib/lazier/object.rb +107 -78
- data/lib/lazier/pathname.rb +1 -3
- data/lib/lazier/settings.rb +22 -30
- data/lib/lazier/string.rb +3 -5
- data/lib/lazier/version.rb +3 -3
- data/spec/lazier/datetime_spec.rb +8 -8
- data/spec/lazier/hash_spec.rb +9 -10
- data/spec/lazier/object_spec.rb +85 -11
- data/spec/lazier/settings_spec.rb +10 -17
- data/spec/lazier_spec.rb +1 -1
- metadata +26 -9
data/doc/Lazier/Pathname.html
CHANGED
@@ -6,13 +6,13 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Lazier::Pathname
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.6.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
@@ -195,17 +195,13 @@ Pathname.new("/usr/bin/ruby").components
|
|
195
195
|
|
196
196
|
20
|
197
197
|
21
|
198
|
-
22
|
199
|
-
23
|
200
|
-
24</pre>
|
198
|
+
22</pre>
|
201
199
|
</td>
|
202
200
|
<td>
|
203
201
|
<pre class="code"><span class="info file"># File 'lib/lazier/pathname.rb', line 20</span>
|
204
202
|
|
205
203
|
<span class='kw'>def</span> <span class='id identifier rubyid_components'>components</span>
|
206
|
-
<span class='id identifier
|
207
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each_filename'>each_filename</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'><<</span> <span class='id identifier rubyid_p'>p</span> <span class='rbrace'>}</span>
|
208
|
-
<span class='id identifier rubyid_rv'>rv</span>
|
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>
|
209
205
|
<span class='kw'>end</span></pre>
|
210
206
|
</td>
|
211
207
|
</tr>
|
@@ -217,9 +213,9 @@ Pathname.new("/usr/bin/ruby").components
|
|
217
213
|
</div>
|
218
214
|
|
219
215
|
<div id="footer">
|
220
|
-
Generated on
|
216
|
+
Generated on Fri May 17 12:03:22 2013 by
|
221
217
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
222
|
-
0.8.
|
218
|
+
0.8.6.1 (ruby-1.9.3).
|
223
219
|
</div>
|
224
220
|
|
225
221
|
</body>
|
data/doc/Lazier/Settings.html
CHANGED
@@ -6,13 +6,13 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Lazier::Settings
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.6.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
@@ -428,7 +428,7 @@
|
|
428
428
|
<li class="public ">
|
429
429
|
<span class="summary_signature">
|
430
430
|
|
431
|
-
<a href="#setup_format_number-instance_method" title="#setup_format_number (instance method)">- (Hash) <strong>setup_format_number</strong>(
|
431
|
+
<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
432
|
|
433
433
|
|
434
434
|
|
@@ -499,8 +499,8 @@
|
|
499
499
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 38</span>
|
500
500
|
|
501
501
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
502
|
-
<span class='
|
503
|
-
<span class='
|
502
|
+
<span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
503
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
504
504
|
<span class='kw'>end</span></pre>
|
505
505
|
</td>
|
506
506
|
</tr>
|
@@ -653,15 +653,7 @@
|
|
653
653
|
114
|
654
654
|
115
|
655
655
|
116
|
656
|
-
117
|
657
|
-
118
|
658
|
-
119
|
659
|
-
120
|
660
|
-
121
|
661
|
-
122
|
662
|
-
123
|
663
|
-
124
|
664
|
-
125</pre>
|
656
|
+
117</pre>
|
665
657
|
</td>
|
666
658
|
<td>
|
667
659
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
|
@@ -680,21 +672,21 @@
|
|
680
672
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
681
673
|
</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>
|
682
674
|
<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>
|
683
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
675
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
684
676
|
<span class='kw'>end</span>
|
685
677
|
|
686
678
|
<span class='comment'># Initializes a new settings object.
|
687
679
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
688
|
-
<span class='
|
689
|
-
<span class='
|
680
|
+
<span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
681
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
690
682
|
<span class='kw'>end</span>
|
691
683
|
|
692
684
|
<span class='comment'># Setups the current instance.
|
693
685
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
|
694
|
-
<span class='
|
695
|
-
<span class='
|
696
|
-
<span class='
|
697
|
-
<span class='
|
686
|
+
<span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
|
687
|
+
<span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
|
688
|
+
<span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
|
689
|
+
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
698
690
|
<span class='kw'>end</span>
|
699
691
|
|
700
692
|
<span class='comment'># Set the current locale for messages.
|
@@ -703,19 +695,19 @@
|
|
703
695
|
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
704
696
|
</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>
|
705
697
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
706
|
-
<span class='
|
698
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
707
699
|
<span class='kw'>end</span>
|
708
700
|
|
709
701
|
<span class='comment'># Setups formatters for a number.
|
710
702
|
</span> <span class='comment'># @see Object#format_number
|
711
703
|
</span> <span class='comment'>#
|
712
|
-
</span> <span class='comment'># @param
|
704
|
+
</span> <span class='comment'># @param precision [Fixnum] The precision to show.
|
713
705
|
</span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
|
714
706
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
715
707
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
716
708
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
717
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier
|
718
|
-
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='
|
709
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
710
|
+
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
719
711
|
<span class='kw'>end</span>
|
720
712
|
|
721
713
|
<span class='comment'># Setups strings representation of booleans.
|
@@ -725,9 +717,7 @@
|
|
725
717
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
726
718
|
</span> <span class='comment'># @return [Hash] The new representations.
|
727
719
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
728
|
-
<span class='id identifier rubyid_true_name'>true_name</span> <span class='op'
|
729
|
-
<span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
730
|
-
<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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
|
720
|
+
<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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
731
721
|
<span class='kw'>end</span>
|
732
722
|
|
733
723
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -737,18 +727,10 @@
|
|
737
727
|
</span> <span class='comment'># @param replace [Boolean] If to discard current formats.
|
738
728
|
</span> <span class='comment'># @return [Hash] The new formats.
|
739
729
|
</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>
|
740
|
-
<span class='
|
730
|
+
<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>
|
741
731
|
|
742
|
-
<span class='
|
743
|
-
|
744
|
-
<span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
745
|
-
<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>
|
746
|
-
<span class='kw'>else</span>
|
747
|
-
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
|
748
|
-
<span class='kw'>end</span>
|
749
|
-
|
750
|
-
<span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
|
751
|
-
<span class='kw'>end</span>
|
732
|
+
<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='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span>
|
733
|
+
<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>
|
752
734
|
|
753
735
|
<span class='ivar'>@date_formats</span>
|
754
736
|
<span class='kw'>end</span>
|
@@ -764,12 +746,14 @@
|
|
764
746
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
765
747
|
</span> <span class='comment'># @return [Hash] The new representations.
|
766
748
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
767
|
-
<span class='id identifier
|
768
|
-
|
769
|
-
<span class='
|
770
|
-
|
771
|
-
|
772
|
-
|
749
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span>
|
750
|
+
|
751
|
+
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
752
|
+
<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>
|
753
|
+
<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>
|
754
|
+
<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>
|
755
|
+
<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>
|
756
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_with_indifferent_access'>with_indifferent_access</span>
|
773
757
|
<span class='kw'>end</span>
|
774
758
|
<span class='kw'>end</span></pre>
|
775
759
|
</td>
|
@@ -918,15 +902,7 @@
|
|
918
902
|
114
|
919
903
|
115
|
920
904
|
116
|
921
|
-
117
|
922
|
-
118
|
923
|
-
119
|
924
|
-
120
|
925
|
-
121
|
926
|
-
122
|
927
|
-
123
|
928
|
-
124
|
929
|
-
125</pre>
|
905
|
+
117</pre>
|
930
906
|
</td>
|
931
907
|
<td>
|
932
908
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
|
@@ -945,21 +921,21 @@
|
|
945
921
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
946
922
|
</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>
|
947
923
|
<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>
|
948
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
924
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
949
925
|
<span class='kw'>end</span>
|
950
926
|
|
951
927
|
<span class='comment'># Initializes a new settings object.
|
952
928
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
953
|
-
<span class='
|
954
|
-
<span class='
|
929
|
+
<span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
930
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
955
931
|
<span class='kw'>end</span>
|
956
932
|
|
957
933
|
<span class='comment'># Setups the current instance.
|
958
934
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
|
959
|
-
<span class='
|
960
|
-
<span class='
|
961
|
-
<span class='
|
962
|
-
<span class='
|
935
|
+
<span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
|
936
|
+
<span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
|
937
|
+
<span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
|
938
|
+
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
963
939
|
<span class='kw'>end</span>
|
964
940
|
|
965
941
|
<span class='comment'># Set the current locale for messages.
|
@@ -968,19 +944,19 @@
|
|
968
944
|
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
969
945
|
</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>
|
970
946
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
971
|
-
<span class='
|
947
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
972
948
|
<span class='kw'>end</span>
|
973
949
|
|
974
950
|
<span class='comment'># Setups formatters for a number.
|
975
951
|
</span> <span class='comment'># @see Object#format_number
|
976
952
|
</span> <span class='comment'>#
|
977
|
-
</span> <span class='comment'># @param
|
953
|
+
</span> <span class='comment'># @param precision [Fixnum] The precision to show.
|
978
954
|
</span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
|
979
955
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
980
956
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
981
957
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
982
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier
|
983
|
-
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='
|
958
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
959
|
+
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
984
960
|
<span class='kw'>end</span>
|
985
961
|
|
986
962
|
<span class='comment'># Setups strings representation of booleans.
|
@@ -990,9 +966,7 @@
|
|
990
966
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
991
967
|
</span> <span class='comment'># @return [Hash] The new representations.
|
992
968
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
993
|
-
<span class='id identifier rubyid_true_name'>true_name</span> <span class='op'
|
994
|
-
<span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
995
|
-
<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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
|
969
|
+
<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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
996
970
|
<span class='kw'>end</span>
|
997
971
|
|
998
972
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -1002,18 +976,10 @@
|
|
1002
976
|
</span> <span class='comment'># @param replace [Boolean] If to discard current formats.
|
1003
977
|
</span> <span class='comment'># @return [Hash] The new formats.
|
1004
978
|
</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>
|
1005
|
-
<span class='
|
1006
|
-
|
1007
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
1008
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
|
1009
|
-
<span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1010
|
-
<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>
|
1011
|
-
<span class='kw'>else</span>
|
1012
|
-
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
|
1013
|
-
<span class='kw'>end</span>
|
979
|
+
<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>
|
1014
980
|
|
1015
|
-
|
1016
|
-
<span class='
|
981
|
+
<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='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span>
|
982
|
+
<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>
|
1017
983
|
|
1018
984
|
<span class='ivar'>@date_formats</span>
|
1019
985
|
<span class='kw'>end</span>
|
@@ -1029,12 +995,14 @@
|
|
1029
995
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
1030
996
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1031
997
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1032
|
-
<span class='id identifier
|
1033
|
-
|
1034
|
-
<span class='
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
998
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span>
|
999
|
+
|
1000
|
+
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1001
|
+
<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>
|
1002
|
+
<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>
|
1003
|
+
<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>
|
1004
|
+
<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>
|
1005
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_with_indifferent_access'>with_indifferent_access</span>
|
1038
1006
|
<span class='kw'>end</span>
|
1039
1007
|
<span class='kw'>end</span></pre>
|
1040
1008
|
</td>
|
@@ -1183,15 +1151,7 @@
|
|
1183
1151
|
114
|
1184
1152
|
115
|
1185
1153
|
116
|
1186
|
-
117
|
1187
|
-
118
|
1188
|
-
119
|
1189
|
-
120
|
1190
|
-
121
|
1191
|
-
122
|
1192
|
-
123
|
1193
|
-
124
|
1194
|
-
125</pre>
|
1154
|
+
117</pre>
|
1195
1155
|
</td>
|
1196
1156
|
<td>
|
1197
1157
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
|
@@ -1210,21 +1170,21 @@
|
|
1210
1170
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
1211
1171
|
</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>
|
1212
1172
|
<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>
|
1213
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1173
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1214
1174
|
<span class='kw'>end</span>
|
1215
1175
|
|
1216
1176
|
<span class='comment'># Initializes a new settings object.
|
1217
1177
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
1218
|
-
<span class='
|
1219
|
-
<span class='
|
1178
|
+
<span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1179
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
1220
1180
|
<span class='kw'>end</span>
|
1221
1181
|
|
1222
1182
|
<span class='comment'># Setups the current instance.
|
1223
1183
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
|
1224
|
-
<span class='
|
1225
|
-
<span class='
|
1226
|
-
<span class='
|
1227
|
-
<span class='
|
1184
|
+
<span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
|
1185
|
+
<span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
|
1186
|
+
<span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
|
1187
|
+
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
1228
1188
|
<span class='kw'>end</span>
|
1229
1189
|
|
1230
1190
|
<span class='comment'># Set the current locale for messages.
|
@@ -1233,19 +1193,19 @@
|
|
1233
1193
|
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
1234
1194
|
</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>
|
1235
1195
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
1236
|
-
<span class='
|
1196
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
1237
1197
|
<span class='kw'>end</span>
|
1238
1198
|
|
1239
1199
|
<span class='comment'># Setups formatters for a number.
|
1240
1200
|
</span> <span class='comment'># @see Object#format_number
|
1241
1201
|
</span> <span class='comment'>#
|
1242
|
-
</span> <span class='comment'># @param
|
1202
|
+
</span> <span class='comment'># @param precision [Fixnum] The precision to show.
|
1243
1203
|
</span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
|
1244
1204
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
1245
1205
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
1246
1206
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
1247
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier
|
1248
|
-
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='
|
1207
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1208
|
+
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1249
1209
|
<span class='kw'>end</span>
|
1250
1210
|
|
1251
1211
|
<span class='comment'># Setups strings representation of booleans.
|
@@ -1255,9 +1215,7 @@
|
|
1255
1215
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
1256
1216
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1257
1217
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1258
|
-
<span class='id identifier rubyid_true_name'>true_name</span> <span class='op'
|
1259
|
-
<span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1260
|
-
<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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
|
1218
|
+
<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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1261
1219
|
<span class='kw'>end</span>
|
1262
1220
|
|
1263
1221
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -1267,18 +1225,10 @@
|
|
1267
1225
|
</span> <span class='comment'># @param replace [Boolean] If to discard current formats.
|
1268
1226
|
</span> <span class='comment'># @return [Hash] The new formats.
|
1269
1227
|
</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>
|
1270
|
-
<span class='
|
1271
|
-
|
1272
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
1273
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
|
1274
|
-
<span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1275
|
-
<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>
|
1276
|
-
<span class='kw'>else</span>
|
1277
|
-
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
|
1278
|
-
<span class='kw'>end</span>
|
1228
|
+
<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>
|
1279
1229
|
|
1280
|
-
|
1281
|
-
<span class='
|
1230
|
+
<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='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span>
|
1231
|
+
<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>
|
1282
1232
|
|
1283
1233
|
<span class='ivar'>@date_formats</span>
|
1284
1234
|
<span class='kw'>end</span>
|
@@ -1294,12 +1244,14 @@
|
|
1294
1244
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
1295
1245
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1296
1246
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1297
|
-
<span class='id identifier
|
1298
|
-
|
1299
|
-
<span class='
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1247
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span>
|
1248
|
+
|
1249
|
+
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1250
|
+
<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>
|
1251
|
+
<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>
|
1252
|
+
<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>
|
1253
|
+
<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>
|
1254
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_with_indifferent_access'>with_indifferent_access</span>
|
1303
1255
|
<span class='kw'>end</span>
|
1304
1256
|
<span class='kw'>end</span></pre>
|
1305
1257
|
</td>
|
@@ -1448,15 +1400,7 @@
|
|
1448
1400
|
114
|
1449
1401
|
115
|
1450
1402
|
116
|
1451
|
-
117
|
1452
|
-
118
|
1453
|
-
119
|
1454
|
-
120
|
1455
|
-
121
|
1456
|
-
122
|
1457
|
-
123
|
1458
|
-
124
|
1459
|
-
125</pre>
|
1403
|
+
117</pre>
|
1460
1404
|
</td>
|
1461
1405
|
<td>
|
1462
1406
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
|
@@ -1475,21 +1419,21 @@
|
|
1475
1419
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
1476
1420
|
</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>
|
1477
1421
|
<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>
|
1478
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1422
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1479
1423
|
<span class='kw'>end</span>
|
1480
1424
|
|
1481
1425
|
<span class='comment'># Initializes a new settings object.
|
1482
1426
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
1483
|
-
<span class='
|
1484
|
-
<span class='
|
1427
|
+
<span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1428
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
1485
1429
|
<span class='kw'>end</span>
|
1486
1430
|
|
1487
1431
|
<span class='comment'># Setups the current instance.
|
1488
1432
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
|
1489
|
-
<span class='
|
1490
|
-
<span class='
|
1491
|
-
<span class='
|
1492
|
-
<span class='
|
1433
|
+
<span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
|
1434
|
+
<span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
|
1435
|
+
<span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
|
1436
|
+
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
1493
1437
|
<span class='kw'>end</span>
|
1494
1438
|
|
1495
1439
|
<span class='comment'># Set the current locale for messages.
|
@@ -1498,19 +1442,19 @@
|
|
1498
1442
|
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
1499
1443
|
</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>
|
1500
1444
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
1501
|
-
<span class='
|
1445
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
1502
1446
|
<span class='kw'>end</span>
|
1503
1447
|
|
1504
1448
|
<span class='comment'># Setups formatters for a number.
|
1505
1449
|
</span> <span class='comment'># @see Object#format_number
|
1506
1450
|
</span> <span class='comment'>#
|
1507
|
-
</span> <span class='comment'># @param
|
1451
|
+
</span> <span class='comment'># @param precision [Fixnum] The precision to show.
|
1508
1452
|
</span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
|
1509
1453
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
1510
1454
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
1511
1455
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
1512
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier
|
1513
|
-
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='
|
1456
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1457
|
+
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1514
1458
|
<span class='kw'>end</span>
|
1515
1459
|
|
1516
1460
|
<span class='comment'># Setups strings representation of booleans.
|
@@ -1520,9 +1464,7 @@
|
|
1520
1464
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
1521
1465
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1522
1466
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1523
|
-
<span class='id identifier rubyid_true_name'>true_name</span> <span class='op'
|
1524
|
-
<span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1525
|
-
<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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
|
1467
|
+
<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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1526
1468
|
<span class='kw'>end</span>
|
1527
1469
|
|
1528
1470
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -1532,18 +1474,10 @@
|
|
1532
1474
|
</span> <span class='comment'># @param replace [Boolean] If to discard current formats.
|
1533
1475
|
</span> <span class='comment'># @return [Hash] The new formats.
|
1534
1476
|
</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>
|
1535
|
-
<span class='
|
1536
|
-
|
1537
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_formats'>formats</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
1538
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_replace'>replace</span> <span class='kw'>then</span>
|
1539
|
-
<span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1540
|
-
<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>
|
1541
|
-
<span class='kw'>else</span>
|
1542
|
-
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
|
1543
|
-
<span class='kw'>end</span>
|
1477
|
+
<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>
|
1544
1478
|
|
1545
|
-
|
1546
|
-
<span class='
|
1479
|
+
<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='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span>
|
1480
|
+
<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>
|
1547
1481
|
|
1548
1482
|
<span class='ivar'>@date_formats</span>
|
1549
1483
|
<span class='kw'>end</span>
|
@@ -1559,12 +1493,14 @@
|
|
1559
1493
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
1560
1494
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1561
1495
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1562
|
-
<span class='id identifier
|
1563
|
-
|
1564
|
-
<span class='
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1496
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span>
|
1497
|
+
|
1498
|
+
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1499
|
+
<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>
|
1500
|
+
<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>
|
1501
|
+
<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>
|
1502
|
+
<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>
|
1503
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_with_indifferent_access'>with_indifferent_access</span>
|
1568
1504
|
<span class='kw'>end</span>
|
1569
1505
|
<span class='kw'>end</span></pre>
|
1570
1506
|
</td>
|
@@ -1713,15 +1649,7 @@
|
|
1713
1649
|
114
|
1714
1650
|
115
|
1715
1651
|
116
|
1716
|
-
117
|
1717
|
-
118
|
1718
|
-
119
|
1719
|
-
120
|
1720
|
-
121
|
1721
|
-
122
|
1722
|
-
123
|
1723
|
-
124
|
1724
|
-
125</pre>
|
1652
|
+
117</pre>
|
1725
1653
|
</td>
|
1726
1654
|
<td>
|
1727
1655
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 20</span>
|
@@ -1740,21 +1668,21 @@
|
|
1740
1668
|
</span> <span class='comment'># @return [Settings] The singleton instance of the settings.
|
1741
1669
|
</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>
|
1742
1670
|
<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>
|
1743
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1671
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1744
1672
|
<span class='kw'>end</span>
|
1745
1673
|
|
1746
1674
|
<span class='comment'># Initializes a new settings object.
|
1747
1675
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
1748
|
-
<span class='
|
1749
|
-
<span class='
|
1676
|
+
<span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='symbol'>:lazier</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_absolute_path'>absolute_path</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/../../locales/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1677
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
1750
1678
|
<span class='kw'>end</span>
|
1751
1679
|
|
1752
1680
|
<span class='comment'># Setups the current instance.
|
1753
1681
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
|
1754
|
-
<span class='
|
1755
|
-
<span class='
|
1756
|
-
<span class='
|
1757
|
-
<span class='
|
1682
|
+
<span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
|
1683
|
+
<span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
|
1684
|
+
<span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
|
1685
|
+
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
1758
1686
|
<span class='kw'>end</span>
|
1759
1687
|
|
1760
1688
|
<span class='comment'># Set the current locale for messages.
|
@@ -1763,19 +1691,19 @@
|
|
1763
1691
|
</span> <span class='comment'># @return [R18n::Translation] The new translation object.
|
1764
1692
|
</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>
|
1765
1693
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span>
|
1766
|
-
<span class='
|
1694
|
+
<span class='id identifier rubyid_setup'>setup</span>
|
1767
1695
|
<span class='kw'>end</span>
|
1768
1696
|
|
1769
1697
|
<span class='comment'># Setups formatters for a number.
|
1770
1698
|
</span> <span class='comment'># @see Object#format_number
|
1771
1699
|
</span> <span class='comment'>#
|
1772
|
-
</span> <span class='comment'># @param
|
1700
|
+
</span> <span class='comment'># @param precision [Fixnum] The precision to show.
|
1773
1701
|
</span> <span class='comment'># @param decimal_separator [String] The string to use as decimal separator.
|
1774
1702
|
</span> <span class='comment'># @param add_string [String] The string to append to the number.
|
1775
1703
|
</span> <span class='comment'># @param k_separator [String] The string to use as thousands separator.
|
1776
1704
|
</span> <span class='comment'># @return [Hash] The new formatters.
|
1777
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier
|
1778
|
-
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='
|
1705
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1706
|
+
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1779
1707
|
<span class='kw'>end</span>
|
1780
1708
|
|
1781
1709
|
<span class='comment'># Setups strings representation of booleans.
|
@@ -1785,9 +1713,7 @@
|
|
1785
1713
|
</span> <span class='comment'># @param false_name [String] The string representation of `false`. Defaults to `No`.
|
1786
1714
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1787
1715
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1788
|
-
<span class='id identifier rubyid_true_name'>true_name</span> <span class='op'
|
1789
|
-
<span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1790
|
-
<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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
|
1716
|
+
<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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1791
1717
|
<span class='kw'>end</span>
|
1792
1718
|
|
1793
1719
|
<span class='comment'># Setups custom formats for dates and times.
|
@@ -1797,18 +1723,10 @@
|
|
1797
1723
|
</span> <span class='comment'># @param replace [Boolean] If to discard current formats.
|
1798
1724
|
</span> <span class='comment'># @return [Hash] The new formats.
|
1799
1725
|
</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>
|
1800
|
-
<span class='
|
1726
|
+
<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>
|
1801
1727
|
|
1802
|
-
<span class='
|
1803
|
-
|
1804
|
-
<span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1805
|
-
<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>
|
1806
|
-
<span class='kw'>else</span>
|
1807
|
-
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
|
1808
|
-
<span class='kw'>end</span>
|
1809
|
-
|
1810
|
-
<span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
|
1811
|
-
<span class='kw'>end</span>
|
1728
|
+
<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='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span>
|
1729
|
+
<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>
|
1812
1730
|
|
1813
1731
|
<span class='ivar'>@date_formats</span>
|
1814
1732
|
<span class='kw'>end</span>
|
@@ -1824,12 +1742,14 @@
|
|
1824
1742
|
</span> <span class='comment'># @param short_days [Array] The abbreviated string representation of days.
|
1825
1743
|
</span> <span class='comment'># @return [Hash] The new representations.
|
1826
1744
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1827
|
-
<span class='id identifier
|
1828
|
-
|
1829
|
-
<span class='
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1745
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span>
|
1746
|
+
|
1747
|
+
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1748
|
+
<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>
|
1749
|
+
<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>
|
1750
|
+
<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>
|
1751
|
+
<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>
|
1752
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_with_indifferent_access'>with_indifferent_access</span>
|
1833
1753
|
<span class='kw'>end</span>
|
1834
1754
|
<span class='kw'>end</span></pre>
|
1835
1755
|
</td>
|
@@ -1917,7 +1837,7 @@
|
|
1917
1837
|
|
1918
1838
|
<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>
|
1919
1839
|
<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>
|
1920
|
-
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='
|
1840
|
+
<span class='ivar'>@instance</span> <span class='op'>||=</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1921
1841
|
<span class='kw'>end</span></pre>
|
1922
1842
|
</td>
|
1923
1843
|
</tr>
|
@@ -1966,10 +1886,10 @@
|
|
1966
1886
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 44</span>
|
1967
1887
|
|
1968
1888
|
<span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
|
1969
|
-
<span class='
|
1970
|
-
<span class='
|
1971
|
-
<span class='
|
1972
|
-
<span class='
|
1889
|
+
<span class='id identifier rubyid_setup_format_number'>setup_format_number</span>
|
1890
|
+
<span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span>
|
1891
|
+
<span class='id identifier rubyid_setup_date_formats'>setup_date_formats</span>
|
1892
|
+
<span class='id identifier rubyid_setup_date_names'>setup_date_names</span>
|
1973
1893
|
<span class='kw'>end</span></pre>
|
1974
1894
|
</td>
|
1975
1895
|
</tr>
|
@@ -2065,17 +1985,13 @@
|
|
2065
1985
|
|
2066
1986
|
78
|
2067
1987
|
79
|
2068
|
-
80
|
2069
|
-
81
|
2070
|
-
82</pre>
|
1988
|
+
80</pre>
|
2071
1989
|
</td>
|
2072
1990
|
<td>
|
2073
1991
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 78</span>
|
2074
1992
|
|
2075
1993
|
<span class='kw'>def</span> <span class='id identifier rubyid_setup_boolean_names'>setup_boolean_names</span><span class='lparen'>(</span><span class='id identifier rubyid_true_name'>true_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2076
|
-
<span class='id identifier rubyid_true_name'>true_name</span> <span class='op'
|
2077
|
-
<span class='id identifier rubyid_false_name'>false_name</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
2078
|
-
<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='comma'>,</span> <span class='kw'>false</span> <span class='op'>=></span> <span class='id identifier rubyid_false_name'>false_name</span><span class='rbrace'>}</span>
|
1994
|
+
<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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><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_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_boolean'>boolean</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
2079
1995
|
<span class='kw'>end</span></pre>
|
2080
1996
|
</td>
|
2081
1997
|
</tr>
|
@@ -2169,39 +2085,23 @@
|
|
2169
2085
|
<pre class="lines">
|
2170
2086
|
|
2171
2087
|
|
2088
|
+
88
|
2089
|
+
89
|
2172
2090
|
90
|
2173
2091
|
91
|
2174
2092
|
92
|
2175
2093
|
93
|
2176
2094
|
94
|
2177
|
-
95
|
2178
|
-
96
|
2179
|
-
97
|
2180
|
-
98
|
2181
|
-
99
|
2182
|
-
100
|
2183
|
-
101
|
2184
|
-
102
|
2185
|
-
103
|
2186
|
-
104
|
2187
|
-
105</pre>
|
2095
|
+
95</pre>
|
2188
2096
|
</td>
|
2189
2097
|
<td>
|
2190
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
2098
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 88</span>
|
2191
2099
|
|
2192
2100
|
<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>
|
2193
|
-
<span class='
|
2101
|
+
<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>
|
2194
2102
|
|
2195
|
-
<span class='
|
2196
|
-
|
2197
|
-
<span class='ivar'>@date_formats</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
2198
|
-
<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>
|
2199
|
-
<span class='kw'>else</span>
|
2200
|
-
<span class='ivar'>@date_formats</span> <span class='op'>=</span> <span class='id identifier rubyid_formats'>formats</span>
|
2201
|
-
<span class='kw'>end</span>
|
2202
|
-
|
2203
|
-
<span class='ivar'>@date_formats</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Time</span><span class='op'>::</span><span class='const'>DATE_FORMATS</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span> <span class='kw'>end</span>
|
2204
|
-
<span class='kw'>end</span>
|
2103
|
+
<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='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</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='rparen'>)</span><span class='rparen'>)</span>
|
2104
|
+
<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>
|
2205
2105
|
|
2206
2106
|
<span class='ivar'>@date_formats</span>
|
2207
2107
|
<span class='kw'>end</span></pre>
|
@@ -2335,25 +2235,29 @@
|
|
2335
2235
|
<pre class="lines">
|
2336
2236
|
|
2337
2237
|
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2238
|
+
107
|
2239
|
+
108
|
2240
|
+
109
|
2241
|
+
110
|
2242
|
+
111
|
2243
|
+
112
|
2244
|
+
113
|
2245
|
+
114
|
2246
|
+
115
|
2247
|
+
116</pre>
|
2346
2248
|
</td>
|
2347
2249
|
<td>
|
2348
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line
|
2250
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 107</span>
|
2349
2251
|
|
2350
2252
|
<span class='kw'>def</span> <span class='id identifier rubyid_setup_date_names'>setup_date_names</span><span class='lparen'>(</span><span class='id identifier rubyid_long_months'>long_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_months'>short_months</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_long_days'>long_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_short_days'>short_days</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2351
|
-
<span class='id identifier
|
2352
|
-
|
2353
|
-
<span class='
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2253
|
+
<span class='id identifier rubyid_definitions'>definitions</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_date'>date</span>
|
2254
|
+
|
2255
|
+
<span class='ivar'>@date_names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
2256
|
+
<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>
|
2257
|
+
<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>
|
2258
|
+
<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>
|
2259
|
+
<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>
|
2260
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_with_indifferent_access'>with_indifferent_access</span>
|
2357
2261
|
<span class='kw'>end</span></pre>
|
2358
2262
|
</td>
|
2359
2263
|
</tr>
|
@@ -2363,7 +2267,7 @@
|
|
2363
2267
|
<div class="method_details ">
|
2364
2268
|
<h3 class="signature " id="setup_format_number-instance_method">
|
2365
2269
|
|
2366
|
-
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>setup_format_number</strong>(
|
2270
|
+
- (<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 = ",")
|
2367
2271
|
|
2368
2272
|
|
2369
2273
|
|
@@ -2382,7 +2286,7 @@
|
|
2382
2286
|
|
2383
2287
|
<li>
|
2384
2288
|
|
2385
|
-
<span class='name'>
|
2289
|
+
<span class='name'>precision</span>
|
2386
2290
|
|
2387
2291
|
|
2388
2292
|
<span class='type'>(<tt>Fixnum</tt>)</span>
|
@@ -2422,7 +2326,7 @@
|
|
2422
2326
|
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
2423
2327
|
|
2424
2328
|
|
2425
|
-
<em class="default">(defaults to: <tt
|
2329
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2426
2330
|
|
2427
2331
|
|
2428
2332
|
—
|
@@ -2488,8 +2392,8 @@
|
|
2488
2392
|
<td>
|
2489
2393
|
<pre class="code"><span class="info file"># File 'lib/lazier/settings.rb', line 68</span>
|
2490
2394
|
|
2491
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier
|
2492
|
-
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='
|
2395
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_format_number'>setup_format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2396
|
+
<span class='ivar'>@format_number</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='label'>precision:</span> <span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='label'>decimal_separator:</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='label'>add_string:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='comma'>,</span> <span class='label'>k_separator:</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
2493
2397
|
<span class='kw'>end</span></pre>
|
2494
2398
|
</td>
|
2495
2399
|
</tr>
|
@@ -2501,9 +2405,9 @@
|
|
2501
2405
|
</div>
|
2502
2406
|
|
2503
2407
|
<div id="footer">
|
2504
|
-
Generated on
|
2408
|
+
Generated on Fri May 17 12:03:22 2013 by
|
2505
2409
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2506
|
-
0.8.
|
2410
|
+
0.8.6.1 (ruby-1.9.3).
|
2507
2411
|
</div>
|
2508
2412
|
|
2509
2413
|
</body>
|