lazier 3.5.1 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.rubocop.yml +29 -0
- data/.travis-gemfile +1 -1
- data/.travis.yml +2 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -3
- data/README.md +1 -1
- data/doc/Lazier.html +56 -68
- data/doc/Lazier/Boolean.html +4 -4
- data/doc/Lazier/Configuration.html +5 -5
- data/doc/Lazier/DateTime.html +29 -29
- data/doc/Lazier/DateTime/ClassMethods.html +136 -124
- data/doc/Lazier/Exceptions.html +4 -4
- data/doc/Lazier/Exceptions/Debug.html +4 -4
- data/doc/Lazier/Exceptions/MissingTranslation.html +4 -4
- data/doc/Lazier/Hash.html +144 -32
- data/doc/Lazier/I18n.html +109 -103
- data/doc/Lazier/Localizer.html +4 -4
- data/doc/Lazier/Math.html +4 -4
- data/doc/Lazier/Math/ClassMethods.html +4 -4
- data/doc/Lazier/Object.html +357 -243
- data/doc/Lazier/Pathname.html +4 -4
- data/doc/Lazier/Settings.html +58 -34
- data/doc/Lazier/String.html +6 -6
- data/doc/Lazier/TimeZone.html +86 -86
- data/doc/Lazier/TimeZone/ClassMethods.html +66 -68
- data/doc/Lazier/Version.html +5 -5
- data/doc/_index.html +5 -5
- data/doc/css/style.css +1 -0
- data/doc/file.README.html +4 -4
- data/doc/frames.html +1 -1
- data/doc/index.html +4 -4
- data/doc/method_list.html +103 -91
- data/doc/top-level-namespace.html +4 -4
- data/lazier.gemspec +2 -2
- data/lib/lazier.rb +59 -22
- data/lib/lazier/boolean.rb +1 -1
- data/lib/lazier/configuration.rb +21 -20
- data/lib/lazier/datetime.rb +127 -101
- data/lib/lazier/hash.rb +20 -12
- data/lib/lazier/i18n.rb +33 -32
- data/lib/lazier/math.rb +1 -1
- data/lib/lazier/object.rb +102 -56
- data/lib/lazier/pathname.rb +1 -1
- data/lib/lazier/settings.rb +4 -2
- data/lib/lazier/string.rb +3 -3
- data/lib/lazier/version.rb +1 -1
- data/spec/lazier/datetime_spec.rb +1 -1
- data/spec/lazier/hash_spec.rb +2 -2
- data/spec/lazier/object_spec.rb +16 -0
- data/spec/lazier/string_spec.rb +4 -10
- data/spec/lazier_spec.rb +9 -9
- data/spec/spec_helper.rb +1 -1
- metadata +7 -6
data/doc/Lazier/Localizer.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Lazier::Localizer
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!"
|
20
|
+
framesUrl = "../frames.html#!Lazier/Localizer.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -536,9 +536,9 @@
|
|
536
536
|
</div>
|
537
537
|
|
538
538
|
<div id="footer">
|
539
|
-
Generated on Sun
|
539
|
+
Generated on Sun Apr 27 17:16:42 2014 by
|
540
540
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
541
|
-
0.8.7.
|
541
|
+
0.8.7.4 (ruby-2.1.0).
|
542
542
|
</div>
|
543
543
|
|
544
544
|
</body>
|
data/doc/Lazier/Math.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Lazier::Math
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!"
|
20
|
+
framesUrl = "../frames.html#!Lazier/Math.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -121,9 +121,9 @@
|
|
121
121
|
</div>
|
122
122
|
|
123
123
|
<div id="footer">
|
124
|
-
Generated on Sun
|
124
|
+
Generated on Sun Apr 27 17:16:42 2014 by
|
125
125
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
126
|
-
0.8.7.
|
126
|
+
0.8.7.4 (ruby-2.1.0).
|
127
127
|
</div>
|
128
128
|
|
129
129
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Lazier::Math::ClassMethods
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '../../';
|
20
|
-
framesUrl = "../../frames.html#!"
|
20
|
+
framesUrl = "../../frames.html#!Lazier/Math/ClassMethods.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -321,9 +321,9 @@
|
|
321
321
|
</div>
|
322
322
|
|
323
323
|
<div id="footer">
|
324
|
-
Generated on Sun
|
324
|
+
Generated on Sun Apr 27 17:16:42 2014 by
|
325
325
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
326
|
-
0.8.7.
|
326
|
+
0.8.7.4 (ruby-2.1.0).
|
327
327
|
</div>
|
328
328
|
|
329
329
|
</body>
|
data/doc/Lazier/Object.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Lazier::Object
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.7.
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
19
19
|
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!"
|
20
|
+
framesUrl = "../frames.html#!Lazier/Object.html";
|
21
21
|
</script>
|
22
22
|
|
23
23
|
|
@@ -183,6 +183,31 @@
|
|
183
183
|
<li class="public ">
|
184
184
|
<span class="summary_signature">
|
185
185
|
|
186
|
+
<a href="#boolean%3F-instance_method" title="#boolean? (instance method)">- (Boolean) <strong>boolean?</strong> </a>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
(also: #is_boolean?)
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the object is a valid boolean value.</p>
|
203
|
+
</div></span>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
|
208
|
+
<li class="public ">
|
209
|
+
<span class="summary_signature">
|
210
|
+
|
186
211
|
<a href="#ensure-instance_method" title="#ensure (instance method)">- (String) <strong>ensure</strong>(default_value, verifier = :blank?) </a>
|
187
212
|
|
188
213
|
|
@@ -229,7 +254,7 @@
|
|
229
254
|
<li class="public ">
|
230
255
|
<span class="summary_signature">
|
231
256
|
|
232
|
-
<a href="#ensure_hash-instance_method" title="#ensure_hash (instance method)">- (Hash) <strong>ensure_hash</strong>(access = nil, default_value = nil, sanitizer = nil) </a>
|
257
|
+
<a href="#ensure_hash-instance_method" title="#ensure_hash (instance method)">- (Hash) <strong>ensure_hash</strong>(access = nil, default_value = nil, sanitizer = nil, &block) </a>
|
233
258
|
|
234
259
|
|
235
260
|
|
@@ -275,10 +300,12 @@
|
|
275
300
|
<li class="public ">
|
276
301
|
<span class="summary_signature">
|
277
302
|
|
278
|
-
<a href="#
|
303
|
+
<a href="#float%3F-instance_method" title="#float? (instance method)">- (Boolean) <strong>float?</strong> </a>
|
279
304
|
|
280
305
|
|
281
306
|
|
307
|
+
(also: #number?, #is_float?, #is_number?)
|
308
|
+
|
282
309
|
</span>
|
283
310
|
|
284
311
|
|
@@ -289,7 +316,7 @@
|
|
289
316
|
|
290
317
|
|
291
318
|
|
292
|
-
<span class="summary_desc"><div class='inline'><p>
|
319
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the object is a valid float.</p>
|
293
320
|
</div></span>
|
294
321
|
|
295
322
|
</li>
|
@@ -298,7 +325,7 @@
|
|
298
325
|
<li class="public ">
|
299
326
|
<span class="summary_signature">
|
300
327
|
|
301
|
-
<a href="#
|
328
|
+
<a href="#for_debug-instance_method" title="#for_debug (instance method)">- (String) <strong>for_debug</strong>(format = :yaml, as_exception = true) </a>
|
302
329
|
|
303
330
|
|
304
331
|
|
@@ -312,7 +339,7 @@
|
|
312
339
|
|
313
340
|
|
314
341
|
|
315
|
-
<span class="summary_desc"><div class='inline'><p>
|
342
|
+
<span class="summary_desc"><div class='inline'><p>Inspects an object.</p>
|
316
343
|
</div></span>
|
317
344
|
|
318
345
|
</li>
|
@@ -321,7 +348,7 @@
|
|
321
348
|
<li class="public ">
|
322
349
|
<span class="summary_signature">
|
323
350
|
|
324
|
-
<a href="#
|
351
|
+
<a href="#format_boolean-instance_method" title="#format_boolean (instance method)">- (String) <strong>format_boolean</strong>(true_name = nil, false_name = nil) </a>
|
325
352
|
|
326
353
|
|
327
354
|
|
@@ -335,7 +362,7 @@
|
|
335
362
|
|
336
363
|
|
337
364
|
|
338
|
-
<span class="summary_desc"><div class='inline'><p>Formats a
|
365
|
+
<span class="summary_desc"><div class='inline'><p>Formats a boolean.</p>
|
339
366
|
</div></span>
|
340
367
|
|
341
368
|
</li>
|
@@ -344,7 +371,7 @@
|
|
344
371
|
<li class="public ">
|
345
372
|
<span class="summary_signature">
|
346
373
|
|
347
|
-
<a href="#
|
374
|
+
<a href="#format_number-instance_method" title="#format_number (instance method)">- (String) <strong>format_number</strong>(precision = nil, decimal_separator = nil, add_string = nil, k_separator = nil) </a>
|
348
375
|
|
349
376
|
|
350
377
|
|
@@ -358,7 +385,7 @@
|
|
358
385
|
|
359
386
|
|
360
387
|
|
361
|
-
<span class="summary_desc"><div class='inline'><p>
|
388
|
+
<span class="summary_desc"><div class='inline'><p>Formats a number.</p>
|
362
389
|
</div></span>
|
363
390
|
|
364
391
|
</li>
|
@@ -367,7 +394,7 @@
|
|
367
394
|
<li class="public ">
|
368
395
|
<span class="summary_signature">
|
369
396
|
|
370
|
-
<a href="#
|
397
|
+
<a href="#indexize-instance_method" title="#indexize (instance method)">- (String) <strong>indexize</strong>(length = 2, filler = "0", formatter = :rjust) </a>
|
371
398
|
|
372
399
|
|
373
400
|
|
@@ -381,7 +408,7 @@
|
|
381
408
|
|
382
409
|
|
383
410
|
|
384
|
-
<span class="summary_desc"><div class='inline'><p>
|
411
|
+
<span class="summary_desc"><div class='inline'><p>Prepares an object to be printed in list summaries, like <code>[01/04] Opening this...</code>.</p>
|
385
412
|
</div></span>
|
386
413
|
|
387
414
|
</li>
|
@@ -390,11 +417,11 @@
|
|
390
417
|
<li class="public ">
|
391
418
|
<span class="summary_signature">
|
392
419
|
|
393
|
-
<a href="#
|
420
|
+
<a href="#integer%3F-instance_method" title="#integer? (instance method)">- (Boolean) <strong>integer?</strong> </a>
|
394
421
|
|
395
422
|
|
396
423
|
|
397
|
-
(also: #
|
424
|
+
(also: #is_integer?)
|
398
425
|
|
399
426
|
</span>
|
400
427
|
|
@@ -406,7 +433,7 @@
|
|
406
433
|
|
407
434
|
|
408
435
|
|
409
|
-
<span class="summary_desc"><div class='inline'><p>Checks if the object is a valid
|
436
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the object is a valid integer.</p>
|
410
437
|
</div></span>
|
411
438
|
|
412
439
|
</li>
|
@@ -415,7 +442,7 @@
|
|
415
442
|
<li class="public ">
|
416
443
|
<span class="summary_signature">
|
417
444
|
|
418
|
-
<a href="#
|
445
|
+
<a href="#normalize_number-instance_method" title="#normalize_number (instance method)">- (String) <strong>normalize_number</strong> </a>
|
419
446
|
|
420
447
|
|
421
448
|
|
@@ -429,7 +456,7 @@
|
|
429
456
|
|
430
457
|
|
431
458
|
|
432
|
-
<span class="summary_desc"><div class='inline'><p>
|
459
|
+
<span class="summary_desc"><div class='inline'><p>Normalizes a number for conversion.</p>
|
433
460
|
</div></span>
|
434
461
|
|
435
462
|
</li>
|
@@ -438,10 +465,12 @@
|
|
438
465
|
<li class="public ">
|
439
466
|
<span class="summary_signature">
|
440
467
|
|
441
|
-
<a href="#
|
468
|
+
<a href="#numeric%3F-instance_method" title="#numeric? (instance method)">- (Boolean) <strong>numeric?</strong>(klass = Integer, matcher = ::Lazier::Object::INTEGER_MATCHER) </a>
|
442
469
|
|
443
470
|
|
444
471
|
|
472
|
+
(also: #is_numeric?)
|
473
|
+
|
445
474
|
</span>
|
446
475
|
|
447
476
|
|
@@ -452,7 +481,7 @@
|
|
452
481
|
|
453
482
|
|
454
483
|
|
455
|
-
<span class="summary_desc"><div class='inline'><p>
|
484
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the object is of a numeric class of matches a numeric string expression.</p>
|
456
485
|
</div></span>
|
457
486
|
|
458
487
|
</li>
|
@@ -584,7 +613,68 @@
|
|
584
613
|
|
585
614
|
|
586
615
|
<div class="method_details first">
|
587
|
-
<h3 class="signature first" id="
|
616
|
+
<h3 class="signature first" id="boolean?-instance_method">
|
617
|
+
|
618
|
+
- (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>boolean?</strong>
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
<span class="aliases">Also known as:
|
623
|
+
<span class="names"><span id='is_boolean?-instance_method'>is_boolean?</span></span>
|
624
|
+
</span>
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
</h3><div class="docstring">
|
629
|
+
<div class="discussion">
|
630
|
+
<p>Checks if the object is a valid boolean value.</p>
|
631
|
+
|
632
|
+
|
633
|
+
</div>
|
634
|
+
</div>
|
635
|
+
<div class="tags">
|
636
|
+
|
637
|
+
<p class="tag_title">Returns:</p>
|
638
|
+
<ul class="return">
|
639
|
+
|
640
|
+
<li>
|
641
|
+
|
642
|
+
|
643
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
—
|
648
|
+
<div class='inline'><p><code>true</code> is a valid boolean value, <code>false</code> otherwise.</p>
|
649
|
+
</div>
|
650
|
+
|
651
|
+
</li>
|
652
|
+
|
653
|
+
</ul>
|
654
|
+
|
655
|
+
</div><table class="source_code">
|
656
|
+
<tr>
|
657
|
+
<td>
|
658
|
+
<pre class="lines">
|
659
|
+
|
660
|
+
|
661
|
+
60
|
662
|
+
61
|
663
|
+
62</pre>
|
664
|
+
</td>
|
665
|
+
<td>
|
666
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 60</span>
|
667
|
+
|
668
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_boolean?'>boolean?</span>
|
669
|
+
<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='op'>!</span><span class='kw'>self</span> <span class='op'>||</span> <span class='id identifier rubyid_to_s'>to_s</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_MATCHER</span>
|
670
|
+
<span class='kw'>end</span></pre>
|
671
|
+
</td>
|
672
|
+
</tr>
|
673
|
+
</table>
|
674
|
+
</div>
|
675
|
+
|
676
|
+
<div class="method_details ">
|
677
|
+
<h3 class="signature " id="ensure-instance_method">
|
588
678
|
|
589
679
|
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>ensure</strong>(default_value, verifier = :blank?)
|
590
680
|
|
@@ -661,13 +751,13 @@
|
|
661
751
|
<pre class="lines">
|
662
752
|
|
663
753
|
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
754
|
+
80
|
755
|
+
81
|
756
|
+
82
|
757
|
+
83</pre>
|
668
758
|
</td>
|
669
759
|
<td>
|
670
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
760
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 80</span>
|
671
761
|
|
672
762
|
<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>
|
673
763
|
<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>
|
@@ -824,17 +914,29 @@
|
|
824
914
|
<pre class="lines">
|
825
915
|
|
826
916
|
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
917
|
+
107
|
918
|
+
108
|
919
|
+
109
|
920
|
+
110
|
921
|
+
111
|
922
|
+
112
|
923
|
+
113
|
924
|
+
114
|
925
|
+
115
|
926
|
+
116
|
927
|
+
117</pre>
|
832
928
|
</td>
|
833
929
|
<td>
|
834
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
930
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 107</span>
|
835
931
|
|
836
932
|
<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>
|
837
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span>
|
933
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span>
|
934
|
+
<span class='kw'>if</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>
|
935
|
+
<span class='id identifier rubyid_dup'>dup</span>
|
936
|
+
<span class='kw'>else</span>
|
937
|
+
<span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>||</span> <span class='lparen'>(</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='const'>NilClass</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
938
|
+
<span class='kw'>end</span>
|
939
|
+
|
838
940
|
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_manipulate_array'>manipulate_array</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_uniq'>uniq</span><span class='comma'>,</span> <span class='id identifier rubyid_compact'>compact</span><span class='comma'>,</span> <span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='lparen'>(</span><span class='id identifier rubyid_block'>block</span> <span class='op'>||</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>||</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span>
|
839
941
|
<span class='id identifier rubyid_manipulate_array'>manipulate_array</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_uniq'>uniq</span><span class='comma'>,</span> <span class='id identifier rubyid_compact'>compact</span><span class='comma'>,</span> <span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span>
|
840
942
|
<span class='kw'>end</span></pre>
|
@@ -846,7 +948,7 @@
|
|
846
948
|
<div class="method_details ">
|
847
949
|
<h3 class="signature " id="ensure_hash-instance_method">
|
848
950
|
|
849
|
-
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>ensure_hash</strong>(access = nil, default_value = nil, sanitizer = nil)
|
951
|
+
- (<tt><span class='object_link'><a href="Hash.html" title="Lazier::Hash (module)">Hash</a></span></tt>) <strong>ensure_hash</strong>(access = nil, default_value = nil, sanitizer = nil, &block)
|
850
952
|
|
851
953
|
|
852
954
|
|
@@ -875,7 +977,8 @@
|
|
875
977
|
|
876
978
|
|
877
979
|
—
|
878
|
-
<div class='inline'><p>The requested access for the keys of the returned object. Can be <code>:strings</code>, <code>:symbols</code> or <code>indifferent</code>.
|
980
|
+
<div class='inline'><p>The requested access for the keys of the returned object. Can be <code>:strings</code>, <code>:symbols</code> or <code>indifferent</code>.
|
981
|
+
If <code>nil</code> the keys are not modified.</p>
|
879
982
|
</div>
|
880
983
|
|
881
984
|
</li>
|
@@ -892,7 +995,9 @@
|
|
892
995
|
|
893
996
|
|
894
997
|
—
|
895
|
-
<div class='inline'><p>The default value to use. If it is an <code>Hash</code>, it is returned as value otherwise it is used to build
|
998
|
+
<div class='inline'><p>The default value to use. If it is an <code>Hash</code>, it is returned as value otherwise it is used to build
|
999
|
+
as a key to build an hash with the current object as only value (everything but strings and symbols are mapped to <code>key</code>).
|
1000
|
+
Passing <code>nil</code> is equal to pass an empty Hash.</p>
|
896
1001
|
</div>
|
897
1002
|
|
898
1003
|
</li>
|
@@ -909,7 +1014,22 @@
|
|
909
1014
|
|
910
1015
|
|
911
1016
|
—
|
912
|
-
<div class='inline'><p>If not <code>nil</code>, the method to use to sanitize values of the hash. <em>Ignored if
|
1017
|
+
<div class='inline'><p>If not <code>nil</code>, the method to use to sanitize values of the hash. <em>Ignored if <code>block</code> is present.</em></p>
|
1018
|
+
</div>
|
1019
|
+
|
1020
|
+
</li>
|
1021
|
+
|
1022
|
+
<li>
|
1023
|
+
|
1024
|
+
<span class='name'>block</span>
|
1025
|
+
|
1026
|
+
|
1027
|
+
<span class='type'>(<tt>Proc</tt>)</span>
|
1028
|
+
|
1029
|
+
|
1030
|
+
|
1031
|
+
—
|
1032
|
+
<div class='inline'><p>A block to sanitize entries. It must accept the value as unique argument.</p>
|
913
1033
|
</div>
|
914
1034
|
|
915
1035
|
</li>
|
@@ -940,51 +1060,25 @@
|
|
940
1060
|
<pre class="lines">
|
941
1061
|
|
942
1062
|
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
111
|
952
|
-
112
|
953
|
-
113
|
954
|
-
114
|
955
|
-
115
|
956
|
-
116
|
957
|
-
117
|
958
|
-
118
|
959
|
-
119
|
960
|
-
120
|
961
|
-
121
|
962
|
-
122
|
963
|
-
123</pre>
|
1063
|
+
129
|
1064
|
+
130
|
1065
|
+
131
|
1066
|
+
132
|
1067
|
+
133
|
1068
|
+
134
|
1069
|
+
135
|
1070
|
+
136</pre>
|
964
1071
|
</td>
|
965
1072
|
<td>
|
966
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1073
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 129</span>
|
967
1074
|
|
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>
|
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
|
970
|
-
|
971
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
972
|
-
<span class='kw'>self</span>
|
973
|
-
<span class='kw'>elsif</span> <span class='id identifier rubyid_default_value'>default_value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='kw'>then</span>
|
974
|
-
<span class='id identifier rubyid_default_value'>default_value</span>
|
975
|
-
<span class='kw'>else</span>
|
976
|
-
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_default_value'>default_value</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'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_default_value'>default_value</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'>Symbol</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>:</span> <span class='symbol'>:key</span>
|
977
|
-
<span class='lbrace'>{</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=></span> <span class='kw'>self</span><span class='rbrace'>}</span>
|
978
|
-
<span class='kw'>end</span>
|
1075
|
+
<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='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1076
|
+
<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_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>NilClass</span><span class='rparen'>)</span>
|
979
1077
|
|
980
|
-
<span class='
|
981
|
-
|
982
|
-
<span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>?</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_sanitizer'>sanitizer</span><span class='rparen'>)</span>
|
983
|
-
<span class='id identifier rubyid_h'>h</span>
|
984
|
-
<span class='rbrace'>}</span>
|
985
|
-
<span class='kw'>end</span>
|
1078
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_convert_to_hash'>convert_to_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_default_value'>default_value</span><span class='rparen'>)</span>
|
1079
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_sanitize_hash'>sanitize_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span><span class='comma'>,</span> <span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span> <span class='op'>||</span> <span class='id identifier rubyid_sanitizer'>sanitizer</span>
|
986
1080
|
|
987
|
-
<span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:ensure_access</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='id identifier rubyid_access'>access</span><span class='rparen'>)</span> <span class='op'>:</span
|
1081
|
+
<span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:ensure_access</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_ensure_access'>ensure_access</span><span class='lparen'>(</span><span class='id identifier rubyid_access'>access</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
988
1082
|
<span class='kw'>end</span></pre>
|
989
1083
|
</td>
|
990
1084
|
</tr>
|
@@ -1071,15 +1165,84 @@
|
|
1071
1165
|
<pre class="lines">
|
1072
1166
|
|
1073
1167
|
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1168
|
+
90
|
1169
|
+
91
|
1170
|
+
92
|
1171
|
+
93
|
1172
|
+
94
|
1173
|
+
95
|
1174
|
+
96</pre>
|
1077
1175
|
</td>
|
1078
1176
|
<td>
|
1079
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1177
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 90</span>
|
1080
1178
|
|
1081
1179
|
<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>
|
1082
|
-
<span class='
|
1180
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>NilClass</span><span class='rparen'>)</span>
|
1181
|
+
<span class='id identifier rubyid_default_value'>default_value</span>
|
1182
|
+
<span class='kw'>else</span>
|
1183
|
+
<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>
|
1184
|
+
<span class='kw'>end</span>
|
1185
|
+
<span class='kw'>end</span></pre>
|
1186
|
+
</td>
|
1187
|
+
</tr>
|
1188
|
+
</table>
|
1189
|
+
</div>
|
1190
|
+
|
1191
|
+
<div class="method_details ">
|
1192
|
+
<h3 class="signature " id="float?-instance_method">
|
1193
|
+
|
1194
|
+
- (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>float?</strong>
|
1195
|
+
|
1196
|
+
|
1197
|
+
|
1198
|
+
<span class="aliases">Also known as:
|
1199
|
+
<span class="names"><span id='number?-instance_method'>number?</span>, <span id='is_float?-instance_method'>is_float?</span>, <span id='is_number?-instance_method'>is_number?</span></span>
|
1200
|
+
</span>
|
1201
|
+
|
1202
|
+
|
1203
|
+
|
1204
|
+
</h3><div class="docstring">
|
1205
|
+
<div class="discussion">
|
1206
|
+
<p>Checks if the object is a valid float.</p>
|
1207
|
+
|
1208
|
+
|
1209
|
+
</div>
|
1210
|
+
</div>
|
1211
|
+
<div class="tags">
|
1212
|
+
|
1213
|
+
<p class="tag_title">Returns:</p>
|
1214
|
+
<ul class="return">
|
1215
|
+
|
1216
|
+
<li>
|
1217
|
+
|
1218
|
+
|
1219
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
1220
|
+
|
1221
|
+
|
1222
|
+
|
1223
|
+
—
|
1224
|
+
<div class='inline'><p><code>true</code> is a valid float, <code>false</code> otherwise.</p>
|
1225
|
+
</div>
|
1226
|
+
|
1227
|
+
</li>
|
1228
|
+
|
1229
|
+
</ul>
|
1230
|
+
|
1231
|
+
</div><table class="source_code">
|
1232
|
+
<tr>
|
1233
|
+
<td>
|
1234
|
+
<pre class="lines">
|
1235
|
+
|
1236
|
+
|
1237
|
+
42
|
1238
|
+
43
|
1239
|
+
44</pre>
|
1240
|
+
</td>
|
1241
|
+
<td>
|
1242
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 42</span>
|
1243
|
+
|
1244
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_float?'>float?</span>
|
1245
|
+
<span class='id identifier rubyid_numeric?'>numeric?</span><span class='lparen'>(</span><span class='const'>Numeric</span><span class='comma'>,</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'>FLOAT_MATCHER</span><span class='rparen'>)</span>
|
1083
1246
|
<span class='kw'>end</span></pre>
|
1084
1247
|
</td>
|
1085
1248
|
</tr>
|
@@ -1166,29 +1329,27 @@
|
|
1166
1329
|
<pre class="lines">
|
1167
1330
|
|
1168
1331
|
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
214</pre>
|
1332
|
+
221
|
1333
|
+
222
|
1334
|
+
223
|
1335
|
+
224
|
1336
|
+
225
|
1337
|
+
226
|
1338
|
+
227
|
1339
|
+
228
|
1340
|
+
229</pre>
|
1179
1341
|
</td>
|
1180
1342
|
<td>
|
1181
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1343
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 221</span>
|
1182
1344
|
|
1183
1345
|
<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>
|
1184
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span>
|
1185
|
-
<span class='kw'>
|
1186
|
-
|
1187
|
-
<span class='kw'>else</span>
|
1188
|
-
|
1189
|
-
<span class='kw'>end</span>
|
1346
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span>
|
1347
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span>
|
1348
|
+
<span class='kw'>when</span> <span class='symbol'>:pretty_json</span> <span class='kw'>then</span> <span class='op'>::</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_pretty_generate'>pretty_generate</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
1349
|
+
<span class='kw'>else</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>to_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1350
|
+
<span class='kw'>end</span>
|
1190
1351
|
|
1191
|
-
<span class='id identifier rubyid_as_exception'>as_exception</span> <span class='op'>?</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Debug</span><span class='
|
1352
|
+
<span class='id identifier rubyid_as_exception'>as_exception</span> <span class='op'>?</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Lazier</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Debug</span><span class='comma'>,</span> <span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
1192
1353
|
<span class='kw'>end</span></pre>
|
1193
1354
|
</td>
|
1194
1355
|
</tr>
|
@@ -1282,13 +1443,13 @@
|
|
1282
1443
|
<pre class="lines">
|
1283
1444
|
|
1284
1445
|
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1446
|
+
201
|
1447
|
+
202
|
1448
|
+
203
|
1449
|
+
204</pre>
|
1289
1450
|
</td>
|
1290
1451
|
<td>
|
1291
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1452
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 201</span>
|
1292
1453
|
|
1293
1454
|
<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>
|
1294
1455
|
<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>
|
@@ -1420,34 +1581,32 @@
|
|
1420
1581
|
<pre class="lines">
|
1421
1582
|
|
1422
1583
|
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
177</pre>
|
1584
|
+
181
|
1585
|
+
182
|
1586
|
+
183
|
1587
|
+
184
|
1588
|
+
185
|
1589
|
+
186
|
1590
|
+
187
|
1591
|
+
188
|
1592
|
+
189
|
1593
|
+
190
|
1594
|
+
191
|
1595
|
+
192
|
1596
|
+
193</pre>
|
1437
1597
|
</td>
|
1438
1598
|
<td>
|
1439
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1599
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 181</span>
|
1440
1600
|
|
1441
1601
|
<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>
|
1442
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_is_number?'>is_number?</span>
|
1602
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_is_number?'>is_number?</span>
|
1443
1603
|
<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_format_number'>format_number</span>
|
1444
1604
|
<span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>||=</span> <span class='id identifier rubyid_settings'>settings</span><span class='lbracket'>[</span><span class='symbol'>:add_string</span><span class='rbracket'>]</span>
|
1445
1605
|
|
1446
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%0.</span><span class='embexpr_beg'>#{</span><span class='lbracket'>[</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>||</span> <span class='id identifier rubyid_settings'>settings</span><span class='lbracket'>[</span><span class='symbol'>:precision</span><span class='rbracket'>]</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='embexpr_end'>}</span><span class='tstring_content'>f</span><span class='tstring_end'>"</span></span
|
1606
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_format'>format</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%0.</span><span class='embexpr_beg'>#{</span><span class='lbracket'>[</span><span class='id identifier rubyid_precision'>precision</span> <span class='op'>||</span> <span class='id identifier rubyid_settings'>settings</span><span class='lbracket'>[</span><span class='symbol'>:precision</span><span class='rbracket'>]</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='embexpr_end'>}</span><span class='tstring_content'>f</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_to_float'>to_float</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1447
1607
|
<span class='id identifier rubyid_rv'>rv</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(\d)(?=(\d{3})+(?!\d))</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\\1</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k_separator'>k_separator</span> <span class='op'>||</span> <span class='id identifier rubyid_settings'>settings</span><span class='lbracket'>[</span><span class='symbol'>:k_separator</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1448
1608
|
<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='id identifier rubyid_decimal_separator'>decimal_separator</span> <span class='op'>||</span> <span class='id identifier rubyid_settings'>settings</span><span class='lbracket'>[</span><span class='symbol'>:decimal_separator</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1449
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'
|
1450
|
-
<span class='id identifier rubyid_rv'>rv</span>
|
1609
|
+
<span class='id identifier rubyid_add_string'>add_string</span> <span class='op'>?</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_add_string'>add_string</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
|
1451
1610
|
<span class='kw'>else</span>
|
1452
1611
|
<span class='kw'>nil</span>
|
1453
1612
|
<span class='kw'>end</span>
|
@@ -1554,15 +1713,15 @@
|
|
1554
1713
|
<pre class="lines">
|
1555
1714
|
|
1556
1715
|
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1716
|
+
212
|
1717
|
+
213
|
1718
|
+
214</pre>
|
1560
1719
|
</td>
|
1561
1720
|
<td>
|
1562
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1721
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 212</span>
|
1563
1722
|
|
1564
1723
|
<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>
|
1565
|
-
<span class='
|
1724
|
+
<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>
|
1566
1725
|
<span class='kw'>end</span></pre>
|
1567
1726
|
</td>
|
1568
1727
|
</tr>
|
@@ -1570,78 +1729,21 @@
|
|
1570
1729
|
</div>
|
1571
1730
|
|
1572
1731
|
<div class="method_details ">
|
1573
|
-
<h3 class="signature " id="
|
1574
|
-
|
1575
|
-
- (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>is_boolean?</strong>
|
1576
|
-
|
1577
|
-
|
1732
|
+
<h3 class="signature " id="integer?-instance_method">
|
1578
1733
|
|
1579
|
-
|
1580
|
-
|
1581
|
-
</h3><div class="docstring">
|
1582
|
-
<div class="discussion">
|
1583
|
-
<p>Checks if the object is a valid boolean value.</p>
|
1584
|
-
|
1585
|
-
|
1586
|
-
</div>
|
1587
|
-
</div>
|
1588
|
-
<div class="tags">
|
1589
|
-
|
1590
|
-
<p class="tag_title">Returns:</p>
|
1591
|
-
<ul class="return">
|
1592
|
-
|
1593
|
-
<li>
|
1594
|
-
|
1595
|
-
|
1596
|
-
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
—
|
1601
|
-
<div class='inline'><p><code>true</code> is a valid boolean value, <code>false</code> otherwise.</p>
|
1602
|
-
</div>
|
1603
|
-
|
1604
|
-
</li>
|
1605
|
-
|
1606
|
-
</ul>
|
1607
|
-
|
1608
|
-
</div><table class="source_code">
|
1609
|
-
<tr>
|
1610
|
-
<td>
|
1611
|
-
<pre class="lines">
|
1612
|
-
|
1613
|
-
|
1614
|
-
49
|
1615
|
-
50
|
1616
|
-
51</pre>
|
1617
|
-
</td>
|
1618
|
-
<td>
|
1619
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 49</span>
|
1620
|
-
|
1621
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_is_boolean?'>is_boolean?</span>
|
1622
|
-
<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='op'>!</span><span class='kw'>self</span> <span class='op'>||</span> <span class='id identifier rubyid_to_s'>to_s</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_MATCHER</span>
|
1623
|
-
<span class='kw'>end</span></pre>
|
1624
|
-
</td>
|
1625
|
-
</tr>
|
1626
|
-
</table>
|
1627
|
-
</div>
|
1628
|
-
|
1629
|
-
<div class="method_details ">
|
1630
|
-
<h3 class="signature " id="is_float?-instance_method">
|
1631
|
-
|
1632
|
-
- (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>is_float?</strong>
|
1734
|
+
- (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>integer?</strong>
|
1633
1735
|
|
1634
1736
|
|
1635
1737
|
|
1636
1738
|
<span class="aliases">Also known as:
|
1637
|
-
<span class="names"><span id='
|
1739
|
+
<span class="names"><span id='is_integer?-instance_method'>is_integer?</span></span>
|
1638
1740
|
</span>
|
1639
1741
|
|
1640
1742
|
|
1641
1743
|
|
1642
1744
|
</h3><div class="docstring">
|
1643
1745
|
<div class="discussion">
|
1644
|
-
<p>Checks if the object is a valid
|
1746
|
+
<p>Checks if the object is a valid integer.</p>
|
1645
1747
|
|
1646
1748
|
|
1647
1749
|
</div>
|
@@ -1659,7 +1761,7 @@
|
|
1659
1761
|
|
1660
1762
|
|
1661
1763
|
—
|
1662
|
-
<div class='inline'><p><code>true</code> is a valid
|
1764
|
+
<div class='inline'><p><code>true</code> is a valid integer, <code>false</code> otherwise.</p>
|
1663
1765
|
</div>
|
1664
1766
|
|
1665
1767
|
</li>
|
@@ -1672,15 +1774,15 @@
|
|
1672
1774
|
<pre class="lines">
|
1673
1775
|
|
1674
1776
|
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1777
|
+
34
|
1778
|
+
35
|
1779
|
+
36</pre>
|
1678
1780
|
</td>
|
1679
1781
|
<td>
|
1680
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1782
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 34</span>
|
1681
1783
|
|
1682
|
-
<span class='kw'>def</span> <span class='id identifier
|
1683
|
-
<span class='id identifier
|
1784
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_integer?'>integer?</span>
|
1785
|
+
<span class='id identifier rubyid_numeric?'>numeric?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='comma'>,</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'>INTEGER_MATCHER</span><span class='rparen'>)</span>
|
1684
1786
|
<span class='kw'>end</span></pre>
|
1685
1787
|
</td>
|
1686
1788
|
</tr>
|
@@ -1688,9 +1790,9 @@
|
|
1688
1790
|
</div>
|
1689
1791
|
|
1690
1792
|
<div class="method_details ">
|
1691
|
-
<h3 class="signature " id="
|
1793
|
+
<h3 class="signature " id="normalize_number-instance_method">
|
1692
1794
|
|
1693
|
-
- (<tt><span class='object_link'><a href="
|
1795
|
+
- (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>normalize_number</strong>
|
1694
1796
|
|
1695
1797
|
|
1696
1798
|
|
@@ -1698,7 +1800,7 @@
|
|
1698
1800
|
|
1699
1801
|
</h3><div class="docstring">
|
1700
1802
|
<div class="discussion">
|
1701
|
-
<p>
|
1803
|
+
<p>Normalizes a number for conversion. Basically this methods removes all separator and ensures that <code>.</code> is used for decimal separator.</p>
|
1702
1804
|
|
1703
1805
|
|
1704
1806
|
</div>
|
@@ -1711,12 +1813,12 @@
|
|
1711
1813
|
<li>
|
1712
1814
|
|
1713
1815
|
|
1714
|
-
<span class='type'>(<tt><span class='object_link'><a href="
|
1816
|
+
<span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
|
1715
1817
|
|
1716
1818
|
|
1717
1819
|
|
1718
1820
|
—
|
1719
|
-
<div class='inline'><p
|
1821
|
+
<div class='inline'><p>The normalized number.</p>
|
1720
1822
|
</div>
|
1721
1823
|
|
1722
1824
|
</li>
|
@@ -1729,15 +1831,15 @@
|
|
1729
1831
|
<pre class="lines">
|
1730
1832
|
|
1731
1833
|
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1834
|
+
27
|
1835
|
+
28
|
1836
|
+
29</pre>
|
1735
1837
|
</td>
|
1736
1838
|
<td>
|
1737
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1839
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 27</span>
|
1738
1840
|
|
1739
|
-
<span class='kw'>def</span> <span class='id identifier
|
1740
|
-
<span class='id identifier
|
1841
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_normalize_number'>normalize_number</span>
|
1842
|
+
<span class='id identifier rubyid_is_boolean?'>is_boolean?</span> <span class='op'>?</span> <span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>:</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='period'>.</span><span class='id identifier rubyid_gsub'>gsub</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='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>,</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1741
1843
|
<span class='kw'>end</span></pre>
|
1742
1844
|
</td>
|
1743
1845
|
</tr>
|
@@ -1745,17 +1847,21 @@
|
|
1745
1847
|
</div>
|
1746
1848
|
|
1747
1849
|
<div class="method_details ">
|
1748
|
-
<h3 class="signature " id="
|
1850
|
+
<h3 class="signature " id="numeric?-instance_method">
|
1749
1851
|
|
1750
|
-
- (<tt><span class='object_link'><a href="
|
1852
|
+
- (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>numeric?</strong>(klass = Integer, matcher = ::Lazier::Object::INTEGER_MATCHER)
|
1751
1853
|
|
1752
1854
|
|
1753
1855
|
|
1856
|
+
<span class="aliases">Also known as:
|
1857
|
+
<span class="names"><span id='is_numeric?-instance_method'>is_numeric?</span></span>
|
1858
|
+
</span>
|
1859
|
+
|
1754
1860
|
|
1755
1861
|
|
1756
1862
|
</h3><div class="docstring">
|
1757
1863
|
<div class="discussion">
|
1758
|
-
<p>
|
1864
|
+
<p>Checks if the object is of a numeric class of matches a numeric string expression.</p>
|
1759
1865
|
|
1760
1866
|
|
1761
1867
|
</div>
|
@@ -1768,12 +1874,12 @@
|
|
1768
1874
|
<li>
|
1769
1875
|
|
1770
1876
|
|
1771
|
-
<span class='type'>(<tt><span class='object_link'><a href="
|
1877
|
+
<span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
|
1772
1878
|
|
1773
1879
|
|
1774
1880
|
|
1775
1881
|
—
|
1776
|
-
<div class='inline'><p>
|
1882
|
+
<div class='inline'><p><code>true</code> is a valid numeric object, <code>false</code> otherwise.</p>
|
1777
1883
|
</div>
|
1778
1884
|
|
1779
1885
|
</li>
|
@@ -1786,15 +1892,15 @@
|
|
1786
1892
|
<pre class="lines">
|
1787
1893
|
|
1788
1894
|
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1895
|
+
52
|
1896
|
+
53
|
1897
|
+
54</pre>
|
1792
1898
|
</td>
|
1793
1899
|
<td>
|
1794
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1900
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 52</span>
|
1795
1901
|
|
1796
|
-
<span class='kw'>def</span> <span class='id identifier
|
1797
|
-
<span class='id identifier
|
1902
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_numeric?'>numeric?</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='const'>Integer</span><span class='comma'>,</span> <span class='id identifier rubyid_matcher'>matcher</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'>INTEGER_MATCHER</span><span class='rparen'>)</span>
|
1903
|
+
<span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</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'>TrueClass</span><span class='rparen'>)</span> <span class='op'>||</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='op'>=~</span> <span class='id identifier rubyid_matcher'>matcher</span>
|
1798
1904
|
<span class='kw'>end</span></pre>
|
1799
1905
|
</td>
|
1800
1906
|
</tr>
|
@@ -1864,12 +1970,12 @@
|
|
1864
1970
|
<pre class="lines">
|
1865
1971
|
|
1866
1972
|
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1973
|
+
169
|
1974
|
+
170
|
1975
|
+
171</pre>
|
1870
1976
|
</td>
|
1871
1977
|
<td>
|
1872
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
1978
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 169</span>
|
1873
1979
|
|
1874
1980
|
<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>
|
1875
1981
|
<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>
|
@@ -1970,12 +2076,12 @@
|
|
1970
2076
|
<pre class="lines">
|
1971
2077
|
|
1972
2078
|
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
2079
|
+
71
|
2080
|
+
72
|
2081
|
+
73</pre>
|
1976
2082
|
</td>
|
1977
2083
|
<td>
|
1978
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
2084
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 71</span>
|
1979
2085
|
|
1980
2086
|
<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
2087
|
<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>
|
@@ -2027,15 +2133,15 @@
|
|
2027
2133
|
<pre class="lines">
|
2028
2134
|
|
2029
2135
|
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2136
|
+
141
|
2137
|
+
142
|
2138
|
+
143</pre>
|
2033
2139
|
</td>
|
2034
2140
|
<td>
|
2035
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
2141
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 141</span>
|
2036
2142
|
|
2037
2143
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_boolean'>to_boolean</span>
|
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='
|
2144
|
+
<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='id identifier rubyid_to_integer'>to_integer</span> <span class='op'>==</span> <span class='int'>1</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='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>MatchData</span><span class='rparen'>)</span>
|
2039
2145
|
<span class='kw'>end</span></pre>
|
2040
2146
|
</td>
|
2041
2147
|
</tr>
|
@@ -2105,15 +2211,23 @@
|
|
2105
2211
|
<pre class="lines">
|
2106
2212
|
|
2107
2213
|
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2214
|
+
157
|
2215
|
+
158
|
2216
|
+
159
|
2217
|
+
160
|
2218
|
+
161
|
2219
|
+
162
|
2220
|
+
163</pre>
|
2111
2221
|
</td>
|
2112
2222
|
<td>
|
2113
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
2223
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 157</span>
|
2114
2224
|
|
2115
2225
|
<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>
|
2116
|
-
<span class='
|
2226
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_is_float?'>is_float?</span>
|
2227
|
+
<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>
|
2228
|
+
<span class='kw'>else</span>
|
2229
|
+
<span class='id identifier rubyid_default_value'>default_value</span>
|
2230
|
+
<span class='kw'>end</span>
|
2117
2231
|
<span class='kw'>end</span></pre>
|
2118
2232
|
</td>
|
2119
2233
|
</tr>
|
@@ -2183,12 +2297,12 @@
|
|
2183
2297
|
<pre class="lines">
|
2184
2298
|
|
2185
2299
|
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2300
|
+
149
|
2301
|
+
150
|
2302
|
+
151</pre>
|
2189
2303
|
</td>
|
2190
2304
|
<td>
|
2191
|
-
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line
|
2305
|
+
<pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 149</span>
|
2192
2306
|
|
2193
2307
|
<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>
|
2194
2308
|
<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>
|
@@ -2203,9 +2317,9 @@
|
|
2203
2317
|
</div>
|
2204
2318
|
|
2205
2319
|
<div id="footer">
|
2206
|
-
Generated on Sun
|
2320
|
+
Generated on Sun Apr 27 17:16:42 2014 by
|
2207
2321
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2208
|
-
0.8.7.
|
2322
|
+
0.8.7.4 (ruby-2.1.0).
|
2209
2323
|
</div>
|
2210
2324
|
|
2211
2325
|
</body>
|