lazier 3.3.10 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis-gemfile +3 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile +4 -4
- data/doc/Lazier.html +2 -2
- data/doc/Lazier/Boolean.html +2 -2
- data/doc/Lazier/Configuration.html +2 -2
- data/doc/Lazier/DateTime.html +2 -2
- data/doc/Lazier/DateTime/ClassMethods.html +2 -2
- data/doc/Lazier/Exceptions.html +2 -2
- data/doc/Lazier/Exceptions/Debug.html +2 -2
- data/doc/Lazier/Exceptions/MissingTranslation.html +2 -2
- data/doc/Lazier/Hash.html +302 -9
- data/doc/Lazier/I18n.html +20 -12
- data/doc/Lazier/Localizer.html +2 -2
- data/doc/Lazier/Math.html +2 -2
- data/doc/Lazier/Math/ClassMethods.html +2 -2
- data/doc/Lazier/Object.html +206 -77
- data/doc/Lazier/Pathname.html +2 -2
- data/doc/Lazier/Settings.html +2 -2
- data/doc/Lazier/String.html +2 -2
- data/doc/Lazier/TimeZone.html +2 -2
- data/doc/Lazier/TimeZone/ClassMethods.html +2 -2
- data/doc/Lazier/Version.html +4 -4
- data/doc/_index.html +2 -2
- data/doc/file.README.html +2 -2
- data/doc/index.html +2 -2
- data/doc/method_list.html +96 -72
- data/doc/top-level-namespace.html +2 -2
- data/lazier.gemspec +2 -2
- data/lib/lazier/hash.rb +38 -1
- data/lib/lazier/i18n.rb +1 -0
- data/lib/lazier/object.rb +10 -0
- data/lib/lazier/version.rb +2 -2
- data/spec/lazier/hash_spec.rb +50 -0
- data/spec/lazier/object_spec.rb +11 -0
- metadata +23 -23
data/doc/Lazier/I18n.html
CHANGED
@@ -388,7 +388,8 @@
|
|
388
388
|
79
|
389
389
|
80
|
390
390
|
81
|
391
|
-
82
|
391
|
+
82
|
392
|
+
83</pre>
|
392
393
|
</td>
|
393
394
|
<td>
|
394
395
|
<pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
|
@@ -403,6 +404,7 @@
|
|
403
404
|
</span> <span class='comment'># @param root [Symbol] The root level of the translation.
|
404
405
|
</span> <span class='comment'># @param path [String] The path where the translations are stored.
|
405
406
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_root'>root</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
407
|
+
<span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_enforce_available_locales'>enforce_available_locales</span> <span class='op'>=</span> <span class='kw'>true</span>
|
406
408
|
<span class='ivar'>@i18n_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
407
409
|
<span class='ivar'>@i18n_locales_path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
408
410
|
<span class='kw'>end</span>
|
@@ -575,7 +577,8 @@
|
|
575
577
|
79
|
576
578
|
80
|
577
579
|
81
|
578
|
-
82
|
580
|
+
82
|
581
|
+
83</pre>
|
579
582
|
</td>
|
580
583
|
<td>
|
581
584
|
<pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
|
@@ -590,6 +593,7 @@
|
|
590
593
|
</span> <span class='comment'># @param root [Symbol] The root level of the translation.
|
591
594
|
</span> <span class='comment'># @param path [String] The path where the translations are stored.
|
592
595
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_root'>root</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
596
|
+
<span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_enforce_available_locales'>enforce_available_locales</span> <span class='op'>=</span> <span class='kw'>true</span>
|
593
597
|
<span class='ivar'>@i18n_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
594
598
|
<span class='ivar'>@i18n_locales_path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
595
599
|
<span class='kw'>end</span>
|
@@ -762,7 +766,8 @@
|
|
762
766
|
79
|
763
767
|
80
|
764
768
|
81
|
765
|
-
82
|
769
|
+
82
|
770
|
+
83</pre>
|
766
771
|
</td>
|
767
772
|
<td>
|
768
773
|
<pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 16</span>
|
@@ -777,6 +782,7 @@
|
|
777
782
|
</span> <span class='comment'># @param root [Symbol] The root level of the translation.
|
778
783
|
</span> <span class='comment'># @param path [String] The path where the translations are stored.
|
779
784
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_root'>root</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
785
|
+
<span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_enforce_available_locales'>enforce_available_locales</span> <span class='op'>=</span> <span class='kw'>true</span>
|
780
786
|
<span class='ivar'>@i18n_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
781
787
|
<span class='ivar'>@i18n_locales_path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
782
788
|
<span class='kw'>end</span>
|
@@ -888,12 +894,12 @@
|
|
888
894
|
<pre class="lines">
|
889
895
|
|
890
896
|
|
891
|
-
33
|
892
897
|
34
|
893
|
-
35
|
898
|
+
35
|
899
|
+
36</pre>
|
894
900
|
</td>
|
895
901
|
<td>
|
896
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line
|
902
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 34</span>
|
897
903
|
|
898
904
|
<span class='kw'>def</span> <span class='id identifier rubyid_i18n'>i18n</span>
|
899
905
|
<span class='ivar'>@i18n</span> <span class='op'>||=</span> <span class='id identifier rubyid_i18n_load_locale'>i18n_load_locale</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
@@ -964,13 +970,13 @@
|
|
964
970
|
<pre class="lines">
|
965
971
|
|
966
972
|
|
967
|
-
41
|
968
973
|
42
|
969
974
|
43
|
970
|
-
44
|
975
|
+
44
|
976
|
+
45</pre>
|
971
977
|
</td>
|
972
978
|
<td>
|
973
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line
|
979
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 42</span>
|
974
980
|
|
975
981
|
<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>
|
976
982
|
<span class='ivar'>@i18n_locale</span> <span class='op'>=</span> <span class='id identifier rubyid_locale'>locale</span>
|
@@ -1043,12 +1049,14 @@
|
|
1043
1049
|
25
|
1044
1050
|
26
|
1045
1051
|
27
|
1046
|
-
28
|
1052
|
+
28
|
1053
|
+
29</pre>
|
1047
1054
|
</td>
|
1048
1055
|
<td>
|
1049
1056
|
<pre class="code"><span class="info file"># File 'lib/lazier/i18n.rb', line 25</span>
|
1050
1057
|
|
1051
1058
|
<span class='kw'>def</span> <span class='id identifier rubyid_i18n_setup'>i18n_setup</span><span class='lparen'>(</span><span class='id identifier rubyid_root'>root</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1059
|
+
<span class='op'>::</span><span class='const'>I18n</span><span class='period'>.</span><span class='id identifier rubyid_enforce_available_locales'>enforce_available_locales</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1052
1060
|
<span class='ivar'>@i18n_root</span> <span class='op'>=</span> <span class='id identifier rubyid_root'>root</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
|
1053
1061
|
<span class='ivar'>@i18n_locales_path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
1054
1062
|
<span class='kw'>end</span></pre>
|
@@ -1062,9 +1070,9 @@
|
|
1062
1070
|
</div>
|
1063
1071
|
|
1064
1072
|
<div id="footer">
|
1065
|
-
Generated on
|
1073
|
+
Generated on Sat Jan 25 11:01:53 2014 by
|
1066
1074
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1067
|
-
0.8.7.3 (ruby-2.
|
1075
|
+
0.8.7.3 (ruby-2.1.0).
|
1068
1076
|
</div>
|
1069
1077
|
|
1070
1078
|
</body>
|
data/doc/Lazier/Localizer.html
CHANGED
@@ -536,9 +536,9 @@
|
|
536
536
|
</div>
|
537
537
|
|
538
538
|
<div id="footer">
|
539
|
-
Generated on
|
539
|
+
Generated on Sat Jan 25 11:01:54 2014 by
|
540
540
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
541
|
-
0.8.7.3 (ruby-2.
|
541
|
+
0.8.7.3 (ruby-2.1.0).
|
542
542
|
</div>
|
543
543
|
|
544
544
|
</body>
|
data/doc/Lazier/Math.html
CHANGED
@@ -121,9 +121,9 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Sat Jan 25 11:01:53 2014 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
|
-
0.8.7.3 (ruby-2.
|
126
|
+
0.8.7.3 (ruby-2.1.0).
|
127
127
|
</div>
|
128
128
|
|
129
129
|
</body>
|
@@ -321,9 +321,9 @@
|
|
321
321
|
</div>
|
322
322
|
|
323
323
|
<div id="footer">
|
324
|
-
Generated on
|
324
|
+
Generated on Sat Jan 25 11:01:53 2014 by
|
325
325
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
326
|
-
0.8.7.3 (ruby-2.
|
326
|
+
0.8.7.3 (ruby-2.1.0).
|
327
327
|
</div>
|
328
328
|
|
329
329
|
</body>
|
data/doc/Lazier/Object.html
CHANGED
@@ -478,6 +478,29 @@
|
|
478
478
|
<span class="summary_desc"><div class='inline'><p>Returns the rounded float representaton of the object.</p>
|
479
479
|
</div></span>
|
480
480
|
|
481
|
+
</li>
|
482
|
+
|
483
|
+
|
484
|
+
<li class="public ">
|
485
|
+
<span class="summary_signature">
|
486
|
+
|
487
|
+
<a href="#safe_send-instance_method" title="#safe_send (instance method)">- (Object|nil) <strong>safe_send</strong>(method, *args, &block) </a>
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
</span>
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
<span class="summary_desc"><div class='inline'><p>Sends a method to the object.</p>
|
502
|
+
</div></span>
|
503
|
+
|
481
504
|
</li>
|
482
505
|
|
483
506
|
|
@@ -638,13 +661,13 @@
|
|
638
661
|
<pre class="lines">
|
639
662
|
|
640
663
|
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
664
|
+
68
|
665
|
+
69
|
666
|
+
70
|
667
|
+
71</pre>
|
645
668
|
</td>
|
646
669
|
<td>
|
647
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
670
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 68</span>
|
648
671
|
|
649
672
|
<span class='kw'>def</span> <span class='kw'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span><span class='comma'>,</span> <span class='id identifier rubyid_verifier'>verifier</span> <span class='op'>=</span> <span class='symbol'>:blank?</span><span class='rparen'>)</span>
|
650
673
|
<span class='id identifier rubyid_valid'>valid</span> <span class='op'>=</span> <span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>?</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_verifier'>verifier</span><span class='rparen'>)</span>
|
@@ -801,14 +824,14 @@
|
|
801
824
|
<pre class="lines">
|
802
825
|
|
803
826
|
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
827
|
+
91
|
828
|
+
92
|
829
|
+
93
|
830
|
+
94
|
831
|
+
95</pre>
|
809
832
|
</td>
|
810
833
|
<td>
|
811
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
834
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 91</span>
|
812
835
|
|
813
836
|
<span class='kw'>def</span> <span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_uniq'>uniq</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_compact'>compact</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_flatten'>flatten</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
814
837
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Array</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_dup'>dup</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
@@ -917,16 +940,6 @@
|
|
917
940
|
<pre class="lines">
|
918
941
|
|
919
942
|
|
920
|
-
93
|
921
|
-
94
|
922
|
-
95
|
923
|
-
96
|
924
|
-
97
|
925
|
-
98
|
926
|
-
99
|
927
|
-
100
|
928
|
-
101
|
929
|
-
102
|
930
943
|
103
|
931
944
|
104
|
932
945
|
105
|
@@ -937,10 +950,20 @@
|
|
937
950
|
110
|
938
951
|
111
|
939
952
|
112
|
940
|
-
113
|
953
|
+
113
|
954
|
+
114
|
955
|
+
115
|
956
|
+
116
|
957
|
+
117
|
958
|
+
118
|
959
|
+
119
|
960
|
+
120
|
961
|
+
121
|
962
|
+
122
|
963
|
+
123</pre>
|
941
964
|
</td>
|
942
965
|
<td>
|
943
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
966
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 103</span>
|
944
967
|
|
945
968
|
<span class='kw'>def</span> <span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_access'>access</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
946
969
|
<span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_default_value'>default_value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
@@ -1048,12 +1071,12 @@
|
|
1048
1071
|
<pre class="lines">
|
1049
1072
|
|
1050
1073
|
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1074
|
+
78
|
1075
|
+
79
|
1076
|
+
80</pre>
|
1054
1077
|
</td>
|
1055
1078
|
<td>
|
1056
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1079
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 78</span>
|
1057
1080
|
|
1058
1081
|
<span class='kw'>def</span> <span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_stringifier'>stringifier</span> <span class='op'>=</span> <span class='symbol'>:to_s</span><span class='rparen'>)</span>
|
1059
1082
|
<span class='op'>!</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='lparen'>(</span><span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>?</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_default_value'>default_value</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_stringifier'>stringifier</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_default_value'>default_value</span>
|
@@ -1143,19 +1166,19 @@
|
|
1143
1166
|
<pre class="lines">
|
1144
1167
|
|
1145
1168
|
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1169
|
+
205
|
1170
|
+
206
|
1171
|
+
207
|
1172
|
+
208
|
1173
|
+
209
|
1174
|
+
210
|
1175
|
+
211
|
1176
|
+
212
|
1177
|
+
213
|
1178
|
+
214</pre>
|
1156
1179
|
</td>
|
1157
1180
|
<td>
|
1158
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1181
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 205</span>
|
1159
1182
|
|
1160
1183
|
<span class='kw'>def</span> <span class='id identifier rubyid_for_debug'>for_debug</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='symbol'>:yaml</span><span class='comma'>,</span> <span class='id identifier rubyid_as_exception'>as_exception</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1161
1184
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span>
|
@@ -1259,13 +1282,13 @@
|
|
1259
1282
|
<pre class="lines">
|
1260
1283
|
|
1261
1284
|
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1285
|
+
185
|
1286
|
+
186
|
1287
|
+
187
|
1288
|
+
188</pre>
|
1266
1289
|
</td>
|
1267
1290
|
<td>
|
1268
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1291
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 185</span>
|
1269
1292
|
|
1270
1293
|
<span class='kw'>def</span> <span class='id identifier rubyid_format_boolean'>format_boolean</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>
|
1271
1294
|
<span class='id identifier rubyid_settings'>settings</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_boolean_names'>boolean_names</span>
|
@@ -1397,23 +1420,23 @@
|
|
1397
1420
|
<pre class="lines">
|
1398
1421
|
|
1399
1422
|
|
1400
|
-
154
|
1401
|
-
155
|
1402
|
-
156
|
1403
|
-
157
|
1404
|
-
158
|
1405
|
-
159
|
1406
|
-
160
|
1407
|
-
161
|
1408
|
-
162
|
1409
|
-
163
|
1410
1423
|
164
|
1411
1424
|
165
|
1412
1425
|
166
|
1413
|
-
167
|
1426
|
+
167
|
1427
|
+
168
|
1428
|
+
169
|
1429
|
+
170
|
1430
|
+
171
|
1431
|
+
172
|
1432
|
+
173
|
1433
|
+
174
|
1434
|
+
175
|
1435
|
+
176
|
1436
|
+
177</pre>
|
1414
1437
|
</td>
|
1415
1438
|
<td>
|
1416
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1439
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 164</span>
|
1417
1440
|
|
1418
1441
|
<span class='kw'>def</span> <span class='id identifier rubyid_format_number'>format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>=</span> <span class='kw'>nil</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='kw'>nil</span><span class='rparen'>)</span>
|
1419
1442
|
<span class='kw'>if</span> <span class='id identifier rubyid_is_number?'>is_number?</span> <span class='kw'>then</span>
|
@@ -1531,12 +1554,12 @@
|
|
1531
1554
|
<pre class="lines">
|
1532
1555
|
|
1533
1556
|
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1557
|
+
196
|
1558
|
+
197
|
1559
|
+
198</pre>
|
1537
1560
|
</td>
|
1538
1561
|
<td>
|
1539
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1562
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 196</span>
|
1540
1563
|
|
1541
1564
|
<span class='kw'>def</span> <span class='id identifier rubyid_indexize'>indexize</span><span class='lparen'>(</span><span class='id identifier rubyid_length'>length</span> <span class='op'>=</span> <span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_filler'>filler</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_formatter'>formatter</span> <span class='op'>=</span> <span class='symbol'>:rjust</span><span class='rparen'>)</span>
|
1542
1565
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_formatter'>formatter</span><span class='comma'>,</span> <span class='id identifier rubyid_length'>length</span><span class='comma'>,</span> <span class='id identifier rubyid_filler'>filler</span><span class='rparen'>)</span>
|
@@ -1841,12 +1864,12 @@
|
|
1841
1864
|
<pre class="lines">
|
1842
1865
|
|
1843
1866
|
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1867
|
+
152
|
1868
|
+
153
|
1869
|
+
154</pre>
|
1847
1870
|
</td>
|
1848
1871
|
<td>
|
1849
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1872
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 152</span>
|
1850
1873
|
|
1851
1874
|
<span class='kw'>def</span> <span class='id identifier rubyid_round_to_precision'>round_to_precision</span><span class='lparen'>(</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>=</span> <span class='int'>2</span><span class='rparen'>)</span>
|
1852
1875
|
<span class='id identifier rubyid_is_number?'>is_number?</span> <span class='op'>?</span> <span class='id identifier rubyid_to_float'>to_float</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_precision'>precision</span><span class='comma'>,</span> <span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
@@ -1854,6 +1877,112 @@
|
|
1854
1877
|
</td>
|
1855
1878
|
</tr>
|
1856
1879
|
</table>
|
1880
|
+
</div>
|
1881
|
+
|
1882
|
+
<div class="method_details ">
|
1883
|
+
<h3 class="signature " id="safe_send-instance_method">
|
1884
|
+
|
1885
|
+
- (<tt><span class='object_link'><a href="" title="Lazier::Object (module)">Object</a></span>|nil</tt>) <strong>safe_send</strong>(method, *args, &block)
|
1886
|
+
|
1887
|
+
|
1888
|
+
|
1889
|
+
|
1890
|
+
|
1891
|
+
</h3><div class="docstring">
|
1892
|
+
<div class="discussion">
|
1893
|
+
<p>Sends a method to the object. If the objects doesn’t not respond to the method, it returns <code>nil</code> instead of raising an exception.</p>
|
1894
|
+
|
1895
|
+
|
1896
|
+
</div>
|
1897
|
+
</div>
|
1898
|
+
<div class="tags">
|
1899
|
+
<p class="tag_title">Parameters:</p>
|
1900
|
+
<ul class="param">
|
1901
|
+
|
1902
|
+
<li>
|
1903
|
+
|
1904
|
+
<span class='name'>method</span>
|
1905
|
+
|
1906
|
+
|
1907
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
1908
|
+
|
1909
|
+
|
1910
|
+
|
1911
|
+
—
|
1912
|
+
<div class='inline'><p>The method to send.</p>
|
1913
|
+
</div>
|
1914
|
+
|
1915
|
+
</li>
|
1916
|
+
|
1917
|
+
<li>
|
1918
|
+
|
1919
|
+
<span class='name'>args</span>
|
1920
|
+
|
1921
|
+
|
1922
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1923
|
+
|
1924
|
+
|
1925
|
+
|
1926
|
+
—
|
1927
|
+
<div class='inline'><p>The arguments to send.</p>
|
1928
|
+
</div>
|
1929
|
+
|
1930
|
+
</li>
|
1931
|
+
|
1932
|
+
<li>
|
1933
|
+
|
1934
|
+
<span class='name'>&block</span>
|
1935
|
+
|
1936
|
+
|
1937
|
+
<span class='type'>(<tt>Proc</tt>)</span>
|
1938
|
+
|
1939
|
+
|
1940
|
+
|
1941
|
+
—
|
1942
|
+
<div class='inline'><p>The block to pass to the method.</p>
|
1943
|
+
</div>
|
1944
|
+
|
1945
|
+
</li>
|
1946
|
+
|
1947
|
+
</ul>
|
1948
|
+
|
1949
|
+
<p class="tag_title">Returns:</p>
|
1950
|
+
<ul class="return">
|
1951
|
+
|
1952
|
+
<li>
|
1953
|
+
|
1954
|
+
|
1955
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Lazier::Object (module)">Object</a></span>|nil</tt>)</span>
|
1956
|
+
|
1957
|
+
|
1958
|
+
|
1959
|
+
—
|
1960
|
+
<div class='inline'><p>The return value of the method or <code>nil</code>, if the object does not respond to the method.</p>
|
1961
|
+
</div>
|
1962
|
+
|
1963
|
+
</li>
|
1964
|
+
|
1965
|
+
</ul>
|
1966
|
+
|
1967
|
+
</div><table class="source_code">
|
1968
|
+
<tr>
|
1969
|
+
<td>
|
1970
|
+
<pre class="lines">
|
1971
|
+
|
1972
|
+
|
1973
|
+
59
|
1974
|
+
60
|
1975
|
+
61</pre>
|
1976
|
+
</td>
|
1977
|
+
<td>
|
1978
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 59</span>
|
1979
|
+
|
1980
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_safe_send'>safe_send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1981
|
+
<span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1982
|
+
<span class='kw'>end</span></pre>
|
1983
|
+
</td>
|
1984
|
+
</tr>
|
1985
|
+
</table>
|
1857
1986
|
</div>
|
1858
1987
|
|
1859
1988
|
<div class="method_details ">
|
@@ -1898,12 +2027,12 @@
|
|
1898
2027
|
<pre class="lines">
|
1899
2028
|
|
1900
2029
|
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
2030
|
+
128
|
2031
|
+
129
|
2032
|
+
130</pre>
|
1904
2033
|
</td>
|
1905
2034
|
<td>
|
1906
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
2035
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 128</span>
|
1907
2036
|
|
1908
2037
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_boolean'>to_boolean</span>
|
1909
2038
|
<span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>TrueClass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>self</span> <span class='op'>==</span> <span class='float'>1.0</span> <span class='op'>||</span> <span class='kw'>self</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>||</span> <span class='op'>!</span><span class='op'>!</span><span class='lparen'>(</span><span class='id identifier rubyid_ensure_string'>ensure_string</span> <span class='op'>=~</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Object</span><span class='op'>::</span><span class='const'>BOOLEAN_TRUE_MATCHER</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>false</span>
|
@@ -1976,12 +2105,12 @@
|
|
1976
2105
|
<pre class="lines">
|
1977
2106
|
|
1978
2107
|
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
2108
|
+
144
|
2109
|
+
145
|
2110
|
+
146</pre>
|
1982
2111
|
</td>
|
1983
2112
|
<td>
|
1984
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
2113
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 144</span>
|
1985
2114
|
|
1986
2115
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_float'>to_float</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='float'>0.0</span><span class='rparen'>)</span>
|
1987
2116
|
<span class='id identifier rubyid_is_float?'>is_float?</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>Kernel</span><span class='period'>.</span><span class='const'>Float</span><span class='lparen'>(</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Numeric</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='id identifier rubyid_normalize_number'>normalize_number</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_default_value'>default_value</span>
|
@@ -2054,12 +2183,12 @@
|
|
2054
2183
|
<pre class="lines">
|
2055
2184
|
|
2056
2185
|
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2186
|
+
136
|
2187
|
+
137
|
2188
|
+
138</pre>
|
2060
2189
|
</td>
|
2061
2190
|
<td>
|
2062
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
2191
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 136</span>
|
2063
2192
|
|
2064
2193
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_integer'>to_integer</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='int'>0</span><span class='rparen'>)</span>
|
2065
2194
|
<span class='id identifier rubyid_to_float'>to_float</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
@@ -2074,9 +2203,9 @@
|
|
2074
2203
|
</div>
|
2075
2204
|
|
2076
2205
|
<div id="footer">
|
2077
|
-
Generated on
|
2206
|
+
Generated on Sat Jan 25 11:01:53 2014 by
|
2078
2207
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2079
|
-
0.8.7.3 (ruby-2.
|
2208
|
+
0.8.7.3 (ruby-2.1.0).
|
2080
2209
|
</div>
|
2081
2210
|
|
2082
2211
|
</body>
|