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 CHANGED
@@ -1,6 +1,6 @@
1
+ Gemfile.lock
2
+ tester.rb
1
3
  coverage/
2
4
  pkg/
3
5
  .idea/
4
- Gemfile.lock
5
- .yardoc
6
- tester.rb
6
+ .yardoc/
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ RSpec::Core::RakeTask.new("spec")
12
12
  namespace :spec do
13
13
  desc "Run all specs with coverage"
14
14
  task :coverage do
15
- ENV["COWTECH_EXTENSIONS_COVERAGE"] = "TRUE"
15
+ ENV["LAZIER_COVERAGE"] = "TRUE"
16
16
  Rake::Task["spec"].invoke
17
17
  end
18
- end
18
+ end
@@ -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 Wed Aug 1 10:01:58 2012 by
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>
@@ -288,7 +288,7 @@
288
288
  </div>
289
289
 
290
290
  <div id="footer">
291
- Generated on Wed Aug 1 10:01:58 2012 by
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>
@@ -778,7 +778,7 @@
778
778
  </div>
779
779
 
780
780
  <div id="footer">
781
- Generated on Wed Aug 1 10:01:58 2012 by
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 Wed Aug 1 10:01:58 2012 by
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>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Wed Aug 1 10:01:58 2012 by
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 Wed Aug 1 10:01:58 2012 by
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>
@@ -384,7 +384,7 @@
384
384
  </div>
385
385
 
386
386
  <div id="footer">
387
- Generated on Wed Aug 1 10:01:58 2012 by
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>
@@ -121,7 +121,7 @@
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Wed Aug 1 10:01:58 2012 by
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 Wed Aug 1 10:01:58 2012 by
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>
@@ -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</pre>
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 147</span>
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'>&quot;</span><span class='tstring_end'>&quot;</span></span>
@@ -611,12 +611,12 @@
611
611
  <pre class="lines">
612
612
 
613
613
 
614
- 54
615
- 55
616
- 56</pre>
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 54</span>
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
- 61
672
- 62
673
- 63</pre>
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 61</span>
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'>&quot;</span><span class='tstring_end'>&quot;</span></span>
@@ -770,17 +770,17 @@
770
770
  <pre class="lines">
771
771
 
772
772
 
773
- 133
774
- 134
775
- 135
776
- 136
777
- 137
778
- 138
779
- 139
780
- 140</pre>
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 133</span>
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
- 118
920
- 119
921
- 120
922
- 121
923
- 122
924
- 123
925
- 124
926
- 125</pre>
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 118</span>
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
- 47
987
- 48
988
- 49</pre>
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 47</span>
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
- 40
1044
- 41
1045
- 42</pre>
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 40</span>
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
- 33
1101
- 34
1102
- 35</pre>
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 33</span>
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
- 26
1158
- 27
1159
- 28</pre>
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 26</span>
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</pre>
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='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>
1226
- <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>
1227
- <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'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</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'>&gt;</span> <span class='int'>1</span>
1228
- <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'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
1235
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</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'>&quot;</span><span class='tstring_content'>1</span><span class='tstring_end'>&quot;</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'>&quot;</span><span class='tstring_content'>0</span><span class='tstring_end'>&quot;</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'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</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'>&gt;</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'>&quot;</span><span class='tstring_end'>&quot;</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
- 106
1299
- 107
1300
- 108</pre>
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 106</span>
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'>&amp;&amp;</span> <span class='id identifier rubyid_prec'>prec</span> <span class='op'>&gt;=</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'>=&gt;</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
- 96
1356
- 97
1357
- 98
1358
- 99
1359
- 100</pre>
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 96</span>
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
- 69
1438
- 70
1439
- 71
1440
- 72
1441
- 73
1442
- 74
1443
- 75
1444
- 76
1445
- 77</pre>
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 69</span>
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
- 83
1528
- 84
1529
- 85
1530
- 86
1531
- 87
1532
- 88
1533
- 89
1534
- 90
1535
- 91</pre>
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 83</span>
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 Wed Aug 1 10:01:58 2012 by
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>
@@ -216,7 +216,7 @@
216
216
  </div>
217
217
 
218
218
  <div id="footer">
219
- Generated on Wed Aug 1 10:01:58 2012 by
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>
@@ -1240,7 +1240,7 @@
1240
1240
  </div>
1241
1241
 
1242
1242
  <div id="footer">
1243
- Generated on Wed Aug 1 10:01:58 2012 by
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>
@@ -462,7 +462,7 @@
462
462
  </div>
463
463
 
464
464
  <div id="footer">
465
- Generated on Wed Aug 1 10:01:58 2012 by
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>
@@ -1666,7 +1666,7 @@
1666
1666
  </div>
1667
1667
 
1668
1668
  <div id="footer">
1669
- Generated on Wed Aug 1 10:01:58 2012 by
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 Wed Aug 1 10:01:58 2012 by
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>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>1</span></pre></dd>
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 Wed Aug 1 10:01:58 2012 by
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>
@@ -297,7 +297,7 @@
297
297
  </div>
298
298
 
299
299
  <div id="footer">
300
- Generated on Wed Aug 1 10:01:58 2012 by
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>
@@ -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 Wed Aug 1 10:01:58 2012 by
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>
@@ -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 Wed Aug 1 10:01:58 2012 by
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 Wed Aug 1 10:01:58 2012 by
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>
@@ -14,10 +14,20 @@ module Lazier
14
14
  #
15
15
  # @return [String] The normalized number.
16
16
  def normalize_number
17
- rv = self.ensure_string.strip
18
- rv = rv.split(/[\.,]/)
19
- rv[-1] = "." + rv[-1] if rv.length > 1
20
- rv.join("")
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.
@@ -16,7 +16,7 @@ module Lazier
16
16
  MINOR = 0
17
17
 
18
18
  # The patch version.
19
- PATCH = 1
19
+ PATCH = 2
20
20
 
21
21
  # The current version of lazier.
22
22
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -7,7 +7,7 @@
7
7
  require "simplecov"
8
8
  require "pathname"
9
9
 
10
- if ENV["COWTECH_EXTENSIONS_COVERAGE"] == "TRUE" then
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 true for a invalid number" do
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 true for a invalid number" do
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 true for a invalid number" do
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 true for a invalid boolean" do
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.1
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-01 00:00:00.000000000 Z
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: -702967981256888408
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: -702967981256888408
264
+ hash: 846071964339718858
265
265
  requirements: []
266
266
  rubyforge_project: lazier
267
267
  rubygems_version: 1.8.24