lazier 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -3
- data/Rakefile +2 -2
- data/doc/Lazier.html +1 -1
- data/doc/Lazier/Boolean.html +1 -1
- data/doc/Lazier/DateTime.html +1 -1
- data/doc/Lazier/DateTime/ClassMethods.html +1 -1
- data/doc/Lazier/Exceptions.html +1 -1
- data/doc/Lazier/Exceptions/Dump.html +1 -1
- data/doc/Lazier/Hash.html +1 -1
- data/doc/Lazier/Math.html +1 -1
- data/doc/Lazier/Math/ClassMethods.html +1 -1
- data/doc/Lazier/Object.html +110 -90
- data/doc/Lazier/Pathname.html +1 -1
- data/doc/Lazier/Settings.html +1 -1
- data/doc/Lazier/String.html +1 -1
- data/doc/Lazier/TimeZone.html +1 -1
- data/doc/Lazier/TimeZone/ClassMethods.html +1 -1
- data/doc/Lazier/Version.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/top-level-namespace.html +1 -1
- data/lib/lazier/object.rb +14 -4
- data/lib/lazier/version.rb +1 -1
- data/spec/coverage_helper.rb +2 -2
- data/spec/cowtech-extensions/object_spec.rb +19 -6
- metadata +4 -4
data/.gitignore
CHANGED
data/Rakefile
CHANGED
data/doc/Lazier.html
CHANGED
@@ -548,7 +548,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
|
|
548
548
|
</div>
|
549
549
|
|
550
550
|
<div id="footer">
|
551
|
-
Generated on
|
551
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
552
552
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
553
553
|
0.8.2.1 (ruby-1.9.2).
|
554
554
|
</div>
|
data/doc/Lazier/Boolean.html
CHANGED
@@ -288,7 +288,7 @@
|
|
288
288
|
</div>
|
289
289
|
|
290
290
|
<div id="footer">
|
291
|
-
Generated on
|
291
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
292
292
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
293
293
|
0.8.2.1 (ruby-1.9.2).
|
294
294
|
</div>
|
data/doc/Lazier/DateTime.html
CHANGED
@@ -778,7 +778,7 @@
|
|
778
778
|
</div>
|
779
779
|
|
780
780
|
<div id="footer">
|
781
|
-
Generated on
|
781
|
+
Generated on Tue Aug 14 14:56:36 2012 by
|
782
782
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
783
783
|
0.8.2.1 (ruby-1.9.2).
|
784
784
|
</div>
|
@@ -1583,7 +1583,7 @@
|
|
1583
1583
|
</div>
|
1584
1584
|
|
1585
1585
|
<div id="footer">
|
1586
|
-
Generated on
|
1586
|
+
Generated on Tue Aug 14 14:56:36 2012 by
|
1587
1587
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1588
1588
|
0.8.2.1 (ruby-1.9.2).
|
1589
1589
|
</div>
|
data/doc/Lazier/Exceptions.html
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Tue Aug 14 14:56:36 2012 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.2.1 (ruby-1.9.2).
|
122
122
|
</div>
|
@@ -124,7 +124,7 @@
|
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div id="footer">
|
127
|
-
Generated on
|
127
|
+
Generated on Tue Aug 14 14:56:36 2012 by
|
128
128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
129
129
|
0.8.2.1 (ruby-1.9.2).
|
130
130
|
</div>
|
data/doc/Lazier/Hash.html
CHANGED
@@ -384,7 +384,7 @@
|
|
384
384
|
</div>
|
385
385
|
|
386
386
|
<div id="footer">
|
387
|
-
Generated on
|
387
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
388
388
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
389
389
|
0.8.2.1 (ruby-1.9.2).
|
390
390
|
</div>
|
data/doc/Lazier/Math.html
CHANGED
@@ -121,7 +121,7 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on
|
124
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
126
|
0.8.2.1 (ruby-1.9.2).
|
127
127
|
</div>
|
@@ -353,7 +353,7 @@
|
|
353
353
|
</div>
|
354
354
|
|
355
355
|
<div id="footer">
|
356
|
-
Generated on
|
356
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
357
357
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
358
358
|
0.8.2.1 (ruby-1.9.2).
|
359
359
|
</div>
|
data/doc/Lazier/Object.html
CHANGED
@@ -530,24 +530,24 @@
|
|
530
530
|
<pre class="lines">
|
531
531
|
|
532
532
|
|
533
|
-
147
|
534
|
-
148
|
535
|
-
149
|
536
|
-
150
|
537
|
-
151
|
538
|
-
152
|
539
|
-
153
|
540
|
-
154
|
541
|
-
155
|
542
|
-
156
|
543
533
|
157
|
544
534
|
158
|
545
535
|
159
|
546
536
|
160
|
547
|
-
161
|
537
|
+
161
|
538
|
+
162
|
539
|
+
163
|
540
|
+
164
|
541
|
+
165
|
542
|
+
166
|
543
|
+
167
|
544
|
+
168
|
545
|
+
169
|
546
|
+
170
|
547
|
+
171</pre>
|
548
548
|
</td>
|
549
549
|
<td>
|
550
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
550
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 157</span>
|
551
551
|
|
552
552
|
<span class='kw'>def</span> <span class='id identifier rubyid_debug_dump'>debug_dump</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_must_raise'>must_raise</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
553
553
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
@@ -611,12 +611,12 @@
|
|
611
611
|
<pre class="lines">
|
612
612
|
|
613
613
|
|
614
|
-
|
615
|
-
|
616
|
-
|
614
|
+
64
|
615
|
+
65
|
616
|
+
66</pre>
|
617
617
|
</td>
|
618
618
|
<td>
|
619
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
619
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 64</span>
|
620
620
|
|
621
621
|
<span class='kw'>def</span> <span class='id identifier rubyid_ensure_array'>ensure_array</span>
|
622
622
|
<span class='kw'>self</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'>Array</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>self</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span>
|
@@ -668,12 +668,12 @@
|
|
668
668
|
<pre class="lines">
|
669
669
|
|
670
670
|
|
671
|
-
|
672
|
-
|
673
|
-
|
671
|
+
71
|
672
|
+
72
|
673
|
+
73</pre>
|
674
674
|
</td>
|
675
675
|
<td>
|
676
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
676
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 71</span>
|
677
677
|
|
678
678
|
<span class='kw'>def</span> <span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
679
679
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>?</span> <span class='kw'>self</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_end'>"</span></span>
|
@@ -770,17 +770,17 @@
|
|
770
770
|
<pre class="lines">
|
771
771
|
|
772
772
|
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
773
|
+
143
|
774
|
+
144
|
775
|
+
145
|
776
|
+
146
|
777
|
+
147
|
778
|
+
148
|
779
|
+
149
|
780
|
+
150</pre>
|
781
781
|
</td>
|
782
782
|
<td>
|
783
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
783
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 143</span>
|
784
784
|
|
785
785
|
<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>
|
786
786
|
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
@@ -916,17 +916,17 @@
|
|
916
916
|
<pre class="lines">
|
917
917
|
|
918
918
|
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
919
|
+
128
|
920
|
+
129
|
921
|
+
130
|
922
|
+
131
|
923
|
+
132
|
924
|
+
133
|
925
|
+
134
|
926
|
+
135</pre>
|
927
927
|
</td>
|
928
928
|
<td>
|
929
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
929
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 128</span>
|
930
930
|
|
931
931
|
<span class='kw'>def</span> <span class='id identifier rubyid_format_number'>format_number</span><span class='lparen'>(</span><span class='id identifier rubyid_prec'>prec</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>
|
932
932
|
<span class='id identifier rubyid_prec'>prec</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_format_number'>format_number</span><span class='lbracket'>[</span><span class='symbol'>:prec</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_prec'>prec</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
@@ -983,12 +983,12 @@
|
|
983
983
|
<pre class="lines">
|
984
984
|
|
985
985
|
|
986
|
-
|
987
|
-
|
988
|
-
|
986
|
+
57
|
987
|
+
58
|
988
|
+
59</pre>
|
989
989
|
</td>
|
990
990
|
<td>
|
991
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
991
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 57</span>
|
992
992
|
|
993
993
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_boolean?'>is_boolean?</span>
|
994
994
|
<span class='kw'>self</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'>TrueClass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>self</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'>FalseClass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='kw'>self</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'>NilClass</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lparen'>(</span><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_strip'>strip</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(1|0|true|false|yes|no|t|f|y|n)$</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span>
|
@@ -1040,12 +1040,12 @@
|
|
1040
1040
|
<pre class="lines">
|
1041
1041
|
|
1042
1042
|
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1043
|
+
50
|
1044
|
+
51
|
1045
|
+
52</pre>
|
1046
1046
|
</td>
|
1047
1047
|
<td>
|
1048
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1048
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 50</span>
|
1049
1049
|
|
1050
1050
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_float?'>is_float?</span>
|
1051
1051
|
<span class='kw'>self</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'>Float</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^([+-]?)(\d+)([.,]\d+)?$</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_number'>normalize_number</span><span class='rparen'>)</span>
|
@@ -1097,12 +1097,12 @@
|
|
1097
1097
|
<pre class="lines">
|
1098
1098
|
|
1099
1099
|
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1100
|
+
43
|
1101
|
+
44
|
1102
|
+
45</pre>
|
1103
1103
|
</td>
|
1104
1104
|
<td>
|
1105
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1105
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 43</span>
|
1106
1106
|
|
1107
1107
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_integer?'>is_integer?</span>
|
1108
1108
|
<span class='kw'>self</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'>Integer</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^([+-]?)(\d+)$</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_number'>normalize_number</span><span class='rparen'>)</span>
|
@@ -1154,12 +1154,12 @@
|
|
1154
1154
|
<pre class="lines">
|
1155
1155
|
|
1156
1156
|
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1157
|
+
36
|
1158
|
+
37
|
1159
|
+
38</pre>
|
1160
1160
|
</td>
|
1161
1161
|
<td>
|
1162
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1162
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 36</span>
|
1163
1163
|
|
1164
1164
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_number?'>is_number?</span>
|
1165
1165
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_float?'>is_float?</span>
|
@@ -1216,16 +1216,36 @@
|
|
1216
1216
|
18
|
1217
1217
|
19
|
1218
1218
|
20
|
1219
|
-
21
|
1219
|
+
21
|
1220
|
+
22
|
1221
|
+
23
|
1222
|
+
24
|
1223
|
+
25
|
1224
|
+
26
|
1225
|
+
27
|
1226
|
+
28
|
1227
|
+
29
|
1228
|
+
30
|
1229
|
+
31</pre>
|
1220
1230
|
</td>
|
1221
1231
|
<td>
|
1222
1232
|
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 16</span>
|
1223
1233
|
|
1224
1234
|
<span class='kw'>def</span> <span class='id identifier rubyid_normalize_number'>normalize_number</span>
|
1225
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='
|
1226
|
-
|
1227
|
-
<span class='
|
1228
|
-
|
1235
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
1236
|
+
|
1237
|
+
<span class='kw'>if</span> <span class='kw'>self</span> <span class='op'>==</span> <span class='kw'>true</span> <span class='kw'>then</span>
|
1238
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1</span><span class='tstring_end'>"</span></span>
|
1239
|
+
<span class='kw'>elsif</span> <span class='op'>!</span><span class='kw'>self</span> <span class='kw'>then</span>
|
1240
|
+
<span class='id identifier rubyid_rv'>rv</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>
|
1241
|
+
<span class='kw'>else</span>
|
1242
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <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_strip'>strip</span>
|
1243
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[\.,]</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
|
1244
|
+
<span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</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='op'>+</span> <span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>1</span>
|
1245
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1246
|
+
<span class='kw'>end</span>
|
1247
|
+
|
1248
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
1229
1249
|
<span class='kw'>end</span></pre>
|
1230
1250
|
</td>
|
1231
1251
|
</tr>
|
@@ -1295,12 +1315,12 @@
|
|
1295
1315
|
<pre class="lines">
|
1296
1316
|
|
1297
1317
|
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1318
|
+
116
|
1319
|
+
117
|
1320
|
+
118</pre>
|
1301
1321
|
</td>
|
1302
1322
|
<td>
|
1303
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1323
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 116</span>
|
1304
1324
|
|
1305
1325
|
<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_prec'>prec</span> <span class='op'>=</span> <span class='int'>2</span><span class='rparen'>)</span>
|
1306
1326
|
<span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_number?'>is_number?</span> <span class='op'>&&</span> <span class='id identifier rubyid_prec'>prec</span> <span class='op'>>=</span> <span class='int'>0</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_number_with_precision'>number_with_precision</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='symbol'>:precision</span> <span class='op'>=></span> <span class='id identifier rubyid_prec'>prec</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
@@ -1352,14 +1372,14 @@
|
|
1352
1372
|
<pre class="lines">
|
1353
1373
|
|
1354
1374
|
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1375
|
+
106
|
1376
|
+
107
|
1377
|
+
108
|
1378
|
+
109
|
1379
|
+
110</pre>
|
1360
1380
|
</td>
|
1361
1381
|
<td>
|
1362
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1382
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 106</span>
|
1363
1383
|
|
1364
1384
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_boolean'>to_boolean</span>
|
1365
1385
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span>
|
@@ -1434,18 +1454,18 @@
|
|
1434
1454
|
<pre class="lines">
|
1435
1455
|
|
1436
1456
|
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1457
|
+
79
|
1458
|
+
80
|
1459
|
+
81
|
1460
|
+
82
|
1461
|
+
83
|
1462
|
+
84
|
1463
|
+
85
|
1464
|
+
86
|
1465
|
+
87</pre>
|
1446
1466
|
</td>
|
1447
1467
|
<td>
|
1448
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1468
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 79</span>
|
1449
1469
|
|
1450
1470
|
<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>
|
1451
1471
|
<span class='kw'>if</span> <span class='kw'>self</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'>Float</span><span class='rparen'>)</span>
|
@@ -1524,18 +1544,18 @@
|
|
1524
1544
|
<pre class="lines">
|
1525
1545
|
|
1526
1546
|
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1547
|
+
93
|
1548
|
+
94
|
1549
|
+
95
|
1550
|
+
96
|
1551
|
+
97
|
1552
|
+
98
|
1553
|
+
99
|
1554
|
+
100
|
1555
|
+
101</pre>
|
1536
1556
|
</td>
|
1537
1557
|
<td>
|
1538
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1558
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 93</span>
|
1539
1559
|
|
1540
1560
|
<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>
|
1541
1561
|
<span class='kw'>if</span> <span class='kw'>self</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'>Integer</span><span class='rparen'>)</span>
|
@@ -1556,7 +1576,7 @@
|
|
1556
1576
|
</div>
|
1557
1577
|
|
1558
1578
|
<div id="footer">
|
1559
|
-
Generated on
|
1579
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
1560
1580
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1561
1581
|
0.8.2.1 (ruby-1.9.2).
|
1562
1582
|
</div>
|
data/doc/Lazier/Pathname.html
CHANGED
@@ -216,7 +216,7 @@
|
|
216
216
|
</div>
|
217
217
|
|
218
218
|
<div id="footer">
|
219
|
-
Generated on
|
219
|
+
Generated on Tue Aug 14 14:56:36 2012 by
|
220
220
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
221
221
|
0.8.2.1 (ruby-1.9.2).
|
222
222
|
</div>
|
data/doc/Lazier/Settings.html
CHANGED
@@ -1240,7 +1240,7 @@
|
|
1240
1240
|
</div>
|
1241
1241
|
|
1242
1242
|
<div id="footer">
|
1243
|
-
Generated on
|
1243
|
+
Generated on Tue Aug 14 14:56:36 2012 by
|
1244
1244
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1245
1245
|
0.8.2.1 (ruby-1.9.2).
|
1246
1246
|
</div>
|
data/doc/Lazier/String.html
CHANGED
@@ -462,7 +462,7 @@
|
|
462
462
|
</div>
|
463
463
|
|
464
464
|
<div id="footer">
|
465
|
-
Generated on
|
465
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
466
466
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
467
467
|
0.8.2.1 (ruby-1.9.2).
|
468
468
|
</div>
|
data/doc/Lazier/TimeZone.html
CHANGED
@@ -1666,7 +1666,7 @@
|
|
1666
1666
|
</div>
|
1667
1667
|
|
1668
1668
|
<div id="footer">
|
1669
|
-
Generated on
|
1669
|
+
Generated on Tue Aug 14 14:56:36 2012 by
|
1670
1670
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1671
1671
|
0.8.2.1 (ruby-1.9.2).
|
1672
1672
|
</div>
|
@@ -1046,7 +1046,7 @@
|
|
1046
1046
|
</div>
|
1047
1047
|
|
1048
1048
|
<div id="footer">
|
1049
|
-
Generated on
|
1049
|
+
Generated on Tue Aug 14 14:56:36 2012 by
|
1050
1050
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1051
1051
|
0.8.2.1 (ruby-1.9.2).
|
1052
1052
|
</div>
|
data/doc/Lazier/Version.html
CHANGED
@@ -149,7 +149,7 @@
|
|
149
149
|
|
150
150
|
</div>
|
151
151
|
</dt>
|
152
|
-
<dd><pre class="code"><span class='int'>
|
152
|
+
<dd><pre class="code"><span class='int'>2</span></pre></dd>
|
153
153
|
|
154
154
|
<dt id="STRING-constant" class="">STRING =
|
155
155
|
<div class="docstring">
|
@@ -180,7 +180,7 @@
|
|
180
180
|
</div>
|
181
181
|
|
182
182
|
<div id="footer">
|
183
|
-
Generated on
|
183
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
184
184
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
185
185
|
0.8.2.1 (ruby-1.9.2).
|
186
186
|
</div>
|
data/doc/_index.html
CHANGED
@@ -297,7 +297,7 @@
|
|
297
297
|
</div>
|
298
298
|
|
299
299
|
<div id="footer">
|
300
|
-
Generated on
|
300
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
301
301
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
302
302
|
0.8.2.1 (ruby-1.9.2).
|
303
303
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -98,7 +98,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
|
|
98
98
|
</div></div>
|
99
99
|
|
100
100
|
<div id="footer">
|
101
|
-
Generated on
|
101
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
102
102
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
103
103
|
0.8.2.1 (ruby-1.9.2).
|
104
104
|
</div>
|
data/doc/index.html
CHANGED
@@ -98,7 +98,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
|
|
98
98
|
</div></div>
|
99
99
|
|
100
100
|
<div id="footer">
|
101
|
-
Generated on
|
101
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
102
102
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
103
103
|
0.8.2.1 (ruby-1.9.2).
|
104
104
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Tue Aug 14 14:56:35 2012 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.2.1 (ruby-1.9.2).
|
109
109
|
</div>
|
data/lib/lazier/object.rb
CHANGED
@@ -14,10 +14,20 @@ module Lazier
|
|
14
14
|
#
|
15
15
|
# @return [String] The normalized number.
|
16
16
|
def normalize_number
|
17
|
-
rv =
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
rv = ""
|
18
|
+
|
19
|
+
if self == true then
|
20
|
+
rv = "1"
|
21
|
+
elsif !self then
|
22
|
+
rv = "0"
|
23
|
+
else
|
24
|
+
rv = self.ensure_string.strip
|
25
|
+
rv = rv.split(/[\.,]/)
|
26
|
+
rv[-1] = "." + rv[-1] if rv.length > 1
|
27
|
+
rv = rv.join("")
|
28
|
+
end
|
29
|
+
|
30
|
+
rv
|
21
31
|
end
|
22
32
|
|
23
33
|
# Checks if the object is a valid number.
|
data/lib/lazier/version.rb
CHANGED
data/spec/coverage_helper.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
require "simplecov"
|
8
8
|
require "pathname"
|
9
9
|
|
10
|
-
if ENV["
|
10
|
+
if ENV["LAZIER_COVERAGE"] == "TRUE" then
|
11
11
|
root = Pathname.new(File.dirname(__FILE__)) + ".."
|
12
12
|
|
13
13
|
SimpleCov.start do
|
@@ -16,4 +16,4 @@ if ENV["COWTECH_EXTENSIONS_COVERAGE"] == "TRUE" then
|
|
16
16
|
path !~ /^lib/
|
17
17
|
end
|
18
18
|
end
|
19
|
-
end
|
19
|
+
end
|
@@ -13,6 +13,9 @@ describe Lazier::Object do
|
|
13
13
|
|
14
14
|
describe "#normalize_number" do
|
15
15
|
it "should correctly sanitize numbers" do
|
16
|
+
expect(true.normalize_number).to eq("1")
|
17
|
+
expect(false.normalize_number).to eq("0")
|
18
|
+
expect(nil.normalize_number).to eq("0")
|
16
19
|
expect(123.normalize_number).to eq("123")
|
17
20
|
expect("123.45".normalize_number).to eq("123.45")
|
18
21
|
expect("1,23.45".normalize_number).to eq("123.45")
|
@@ -31,20 +34,22 @@ describe Lazier::Object do
|
|
31
34
|
expect("+1.231,45".is_number?).to be_true
|
32
35
|
end
|
33
36
|
|
34
|
-
it "should return
|
37
|
+
it "should return false for a invalid number" do
|
35
38
|
expect("s213".is_number?).to be_false
|
36
|
-
expect(nil.is_number?).to be_false
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
42
|
describe "#is_integer?" do
|
41
43
|
it "should return true for a valid number" do
|
44
|
+
expect(true.is_integer?).to be_true
|
45
|
+
expect(false.is_integer?).to be_true
|
46
|
+
expect(nil.is_integer?).to be_true
|
42
47
|
expect("123".is_integer?).to be_true
|
43
48
|
expect("-123".is_integer?).to be_true
|
44
49
|
expect("+123".is_integer?).to be_true
|
45
50
|
end
|
46
51
|
|
47
|
-
it "should return
|
52
|
+
it "should return false for a invalid number" do
|
48
53
|
expect("s123".is_integer?).to be_false
|
49
54
|
expect("123.12".is_integer?).to be_false
|
50
55
|
end
|
@@ -52,6 +57,9 @@ describe Lazier::Object do
|
|
52
57
|
|
53
58
|
describe "#is_float?" do
|
54
59
|
it "should return true for a valid number" do
|
60
|
+
expect(true.is_float?).to be_true
|
61
|
+
expect(false.is_float?).to be_true
|
62
|
+
expect(nil.is_float?).to be_true
|
55
63
|
expect("123.45".is_float?).to be_true
|
56
64
|
expect("1,23.45".is_float?).to be_true
|
57
65
|
expect("-1.23.45".is_float?).to be_true
|
@@ -59,9 +67,8 @@ describe Lazier::Object do
|
|
59
67
|
expect("+1.231,45".is_float?).to be_true
|
60
68
|
end
|
61
69
|
|
62
|
-
it "should return
|
70
|
+
it "should return false for a invalid number" do
|
63
71
|
expect("s213".is_float?).to be_false
|
64
|
-
expect(nil.is_float?).to be_false
|
65
72
|
end
|
66
73
|
end
|
67
74
|
|
@@ -84,7 +91,7 @@ describe Lazier::Object do
|
|
84
91
|
expect(0.is_boolean?).to be_true
|
85
92
|
end
|
86
93
|
|
87
|
-
it "should return
|
94
|
+
it "should return false for a invalid boolean" do
|
88
95
|
expect("11".is_boolean?).to be_false
|
89
96
|
end
|
90
97
|
end
|
@@ -101,6 +108,9 @@ describe Lazier::Object do
|
|
101
108
|
|
102
109
|
describe "#to_float" do
|
103
110
|
it "should correctly convert number" do
|
111
|
+
expect(true.to_float).to eq(1.0)
|
112
|
+
expect(false.to_float).to eq(0.0)
|
113
|
+
expect(nil.to_float).to eq(0.0)
|
104
114
|
expect(123.45.to_float).to eq(123.45)
|
105
115
|
expect(123.to_float).to eq(123.00)
|
106
116
|
expect("123.45".to_float).to eq(123.45)
|
@@ -121,6 +131,9 @@ describe Lazier::Object do
|
|
121
131
|
|
122
132
|
describe "#to_integer" do
|
123
133
|
it "should correctly convert number" do
|
134
|
+
expect(true.to_integer).to eq(1)
|
135
|
+
expect(false.to_integer).to eq(0)
|
136
|
+
expect(nil.to_integer).to eq(0)
|
124
137
|
expect(123.45.to_integer).to eq(123)
|
125
138
|
expect(123.to_integer).to eq(123)
|
126
139
|
expect("+123".to_integer).to eq(123)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -252,7 +252,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
252
252
|
version: '0'
|
253
253
|
segments:
|
254
254
|
- 0
|
255
|
-
hash:
|
255
|
+
hash: 846071964339718858
|
256
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
257
|
none: false
|
258
258
|
requirements:
|
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
261
|
version: '0'
|
262
262
|
segments:
|
263
263
|
- 0
|
264
|
-
hash:
|
264
|
+
hash: 846071964339718858
|
265
265
|
requirements: []
|
266
266
|
rubyforge_project: lazier
|
267
267
|
rubygems_version: 1.8.24
|