lazier 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/.gitignore +6 -0
  2. data/.travis.yml +8 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +9 -0
  5. data/Gemfile.lock +82 -0
  6. data/README.md +33 -0
  7. data/Rakefile +18 -0
  8. data/doc/Lazier.html +557 -0
  9. data/doc/Lazier/Boolean.html +297 -0
  10. data/doc/Lazier/DateTime.html +787 -0
  11. data/doc/Lazier/DateTime/ClassMethods.html +1592 -0
  12. data/doc/Lazier/Exceptions.html +125 -0
  13. data/doc/Lazier/Exceptions/Dump.html +133 -0
  14. data/doc/Lazier/Hash.html +393 -0
  15. data/doc/Lazier/Math.html +130 -0
  16. data/doc/Lazier/Math/ClassMethods.html +362 -0
  17. data/doc/Lazier/Object.html +1565 -0
  18. data/doc/Lazier/Pathname.html +225 -0
  19. data/doc/Lazier/Settings.html +1249 -0
  20. data/doc/Lazier/String.html +471 -0
  21. data/doc/Lazier/TimeZone.html +1675 -0
  22. data/doc/Lazier/TimeZone/ClassMethods.html +1055 -0
  23. data/doc/Lazier/Version.html +189 -0
  24. data/doc/_index.html +306 -0
  25. data/doc/class_list.html +53 -0
  26. data/doc/css/common.css +1 -0
  27. data/doc/css/full_list.css +57 -0
  28. data/doc/css/style.css +328 -0
  29. data/doc/file.README.html +107 -0
  30. data/doc/file_list.html +55 -0
  31. data/doc/frames.html +28 -0
  32. data/doc/index.html +107 -0
  33. data/doc/js/app.js +214 -0
  34. data/doc/js/full_list.js +173 -0
  35. data/doc/js/jquery.js +4 -0
  36. data/doc/method_list.html +652 -0
  37. data/doc/top-level-namespace.html +112 -0
  38. data/lazier.gemspec +36 -0
  39. data/lib/lazier.rb +127 -0
  40. data/lib/lazier/boolean.rb +26 -0
  41. data/lib/lazier/datetime.rb +548 -0
  42. data/lib/lazier/exceptions.rb +14 -0
  43. data/lib/lazier/hash.rb +40 -0
  44. data/lib/lazier/math.rb +47 -0
  45. data/lib/lazier/object.rb +163 -0
  46. data/lib/lazier/pathname.rb +26 -0
  47. data/lib/lazier/settings.rb +118 -0
  48. data/lib/lazier/string.rb +54 -0
  49. data/lib/lazier/version.rb +24 -0
  50. data/spec/coverage_helper.rb +19 -0
  51. data/spec/cowtech-extensions/boolean_spec.rb +30 -0
  52. data/spec/cowtech-extensions/datetime_spec.rb +352 -0
  53. data/spec/cowtech-extensions/hash_spec.rb +30 -0
  54. data/spec/cowtech-extensions/math_spec.rb +41 -0
  55. data/spec/cowtech-extensions/object_spec.rb +231 -0
  56. data/spec/cowtech-extensions/pathname_spec.rb +21 -0
  57. data/spec/cowtech-extensions/settings_spec.rb +118 -0
  58. data/spec/cowtech-extensions/string_spec.rb +45 -0
  59. data/spec/lazier_spec.rb +57 -0
  60. data/spec/spec_helper.rb +16 -0
  61. metadata +292 -0
@@ -0,0 +1,1565 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Lazier::Object
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (O)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Lazier.html" title="Lazier (module)">Lazier</a></span></span>
36
+ &raquo;
37
+ <span class="title">Object</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: Lazier::Object
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+ <dt class="r1">Extended by:</dt>
77
+ <dd class="r1">ActiveSupport::Concern</dd>
78
+
79
+
80
+
81
+
82
+ <dt class="r2">Includes:</dt>
83
+ <dd class="r2">ActionView::Helpers::NumberHelper</dd>
84
+
85
+
86
+
87
+
88
+
89
+ <dt class="r1 last">Defined in:</dt>
90
+ <dd class="r1 last">lib/lazier/object.rb</dd>
91
+
92
+ </dl>
93
+ <div class="clear"></div>
94
+
95
+ <h2>Overview</h2><div class="docstring">
96
+ <div class="discussion">
97
+ <p>Extensions for all objects.</p>
98
+
99
+
100
+ </div>
101
+ </div>
102
+ <div class="tags">
103
+
104
+
105
+ </div>
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+ <h2>
114
+ Instance Method Summary
115
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
116
+ </h2>
117
+
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#debug_dump-instance_method" title="#debug_dump (instance method)">- (String) <strong>debug_dump</strong>(format = :yaml, must_raise = true) </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+ <span class="summary_desc"><div class='inline'><p>Inspects an object.</p>
138
+ </div></span>
139
+
140
+ </li>
141
+
142
+
143
+ <li class="public ">
144
+ <span class="summary_signature">
145
+
146
+ <a href="#ensure_array-instance_method" title="#ensure_array (instance method)">- (Array) <strong>ensure_array</strong> </a>
147
+
148
+
149
+
150
+ </span>
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+ <span class="summary_desc"><div class='inline'><p>Makes sure that the object is an array.</p>
161
+ </div></span>
162
+
163
+ </li>
164
+
165
+
166
+ <li class="public ">
167
+ <span class="summary_signature">
168
+
169
+ <a href="#ensure_string-instance_method" title="#ensure_string (instance method)">- (String) <strong>ensure_string</strong> </a>
170
+
171
+
172
+
173
+ </span>
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+ <span class="summary_desc"><div class='inline'><p>Makes sure that the object is a string.</p>
184
+ </div></span>
185
+
186
+ </li>
187
+
188
+
189
+ <li class="public ">
190
+ <span class="summary_signature">
191
+
192
+ <a href="#format_boolean-instance_method" title="#format_boolean (instance method)">- (String) <strong>format_boolean</strong>(true_name = nil, false_name = nil) </a>
193
+
194
+
195
+
196
+ </span>
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+ <span class="summary_desc"><div class='inline'><p>Formats a boolean.</p>
207
+ </div></span>
208
+
209
+ </li>
210
+
211
+
212
+ <li class="public ">
213
+ <span class="summary_signature">
214
+
215
+ <a href="#format_number-instance_method" title="#format_number (instance method)">- (String) <strong>format_number</strong>(prec = nil, decimal_separator = nil, add_string = nil, k_separator = nil) </a>
216
+
217
+
218
+
219
+ </span>
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+ <span class="summary_desc"><div class='inline'><p>Formats a number.</p>
230
+ </div></span>
231
+
232
+ </li>
233
+
234
+
235
+ <li class="public ">
236
+ <span class="summary_signature">
237
+
238
+ <a href="#is_boolean%3F-instance_method" title="#is_boolean? (instance method)">- (Boolean) <strong>is_boolean?</strong> </a>
239
+
240
+
241
+
242
+ </span>
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+ <span class="summary_desc"><div class='inline'><p>Checks if the object is a valid boolean value.</p>
253
+ </div></span>
254
+
255
+ </li>
256
+
257
+
258
+ <li class="public ">
259
+ <span class="summary_signature">
260
+
261
+ <a href="#is_float%3F-instance_method" title="#is_float? (instance method)">- (Boolean) <strong>is_float?</strong> </a>
262
+
263
+
264
+
265
+ </span>
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+ <span class="summary_desc"><div class='inline'><p>Checks if the object is a valid float.</p>
276
+ </div></span>
277
+
278
+ </li>
279
+
280
+
281
+ <li class="public ">
282
+ <span class="summary_signature">
283
+
284
+ <a href="#is_integer%3F-instance_method" title="#is_integer? (instance method)">- (Boolean) <strong>is_integer?</strong> </a>
285
+
286
+
287
+
288
+ </span>
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+ <span class="summary_desc"><div class='inline'><p>Checks if the object is a valid integer.</p>
299
+ </div></span>
300
+
301
+ </li>
302
+
303
+
304
+ <li class="public ">
305
+ <span class="summary_signature">
306
+
307
+ <a href="#is_number%3F-instance_method" title="#is_number? (instance method)">- (Boolean) <strong>is_number?</strong> </a>
308
+
309
+
310
+
311
+ </span>
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+ <span class="summary_desc"><div class='inline'><p>Checks if the object is a valid number.</p>
322
+ </div></span>
323
+
324
+ </li>
325
+
326
+
327
+ <li class="public ">
328
+ <span class="summary_signature">
329
+
330
+ <a href="#normalize_number-instance_method" title="#normalize_number (instance method)">- (String) <strong>normalize_number</strong> </a>
331
+
332
+
333
+
334
+ </span>
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+ <span class="summary_desc"><div class='inline'><p>Normalizes a number for conversion.</p>
345
+ </div></span>
346
+
347
+ </li>
348
+
349
+
350
+ <li class="public ">
351
+ <span class="summary_signature">
352
+
353
+ <a href="#round_to_precision-instance_method" title="#round_to_precision (instance method)">- (Float) <strong>round_to_precision</strong>(prec = 2) </a>
354
+
355
+
356
+
357
+ </span>
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+ <span class="summary_desc"><div class='inline'><p>Returns the rounded float representaton of the object.</p>
368
+ </div></span>
369
+
370
+ </li>
371
+
372
+
373
+ <li class="public ">
374
+ <span class="summary_signature">
375
+
376
+ <a href="#to_boolean-instance_method" title="#to_boolean (instance method)">- (Boolean) <strong>to_boolean</strong> </a>
377
+
378
+
379
+
380
+ </span>
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+ <span class="summary_desc"><div class='inline'><p>Converts the object to a boolean.</p>
391
+ </div></span>
392
+
393
+ </li>
394
+
395
+
396
+ <li class="public ">
397
+ <span class="summary_signature">
398
+
399
+ <a href="#to_float-instance_method" title="#to_float (instance method)">- (Float) <strong>to_float</strong>(default_value = 0.0) </a>
400
+
401
+
402
+
403
+ </span>
404
+
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+ <span class="summary_desc"><div class='inline'><p>Converts the object to a float.</p>
414
+ </div></span>
415
+
416
+ </li>
417
+
418
+
419
+ <li class="public ">
420
+ <span class="summary_signature">
421
+
422
+ <a href="#to_integer-instance_method" title="#to_integer (instance method)">- (Fixnum) <strong>to_integer</strong>(default_value = 0) </a>
423
+
424
+
425
+
426
+ </span>
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+ <span class="summary_desc"><div class='inline'><p>Converts the object to a integer.</p>
437
+ </div></span>
438
+
439
+ </li>
440
+
441
+
442
+ </ul>
443
+
444
+
445
+
446
+
447
+
448
+
449
+ <div id="instance_method_details" class="method_details_list">
450
+ <h2>Instance Method Details</h2>
451
+
452
+
453
+ <div class="method_details first">
454
+ <h3 class="signature first" id="debug_dump-instance_method">
455
+
456
+ - (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>debug_dump</strong>(format = :yaml, must_raise = true)
457
+
458
+
459
+
460
+
461
+
462
+ </h3><div class="docstring">
463
+ <div class="discussion">
464
+ <p>Inspects an object.</p>
465
+
466
+
467
+ </div>
468
+ </div>
469
+ <div class="tags">
470
+ <p class="tag_title">Parameters:</p>
471
+ <ul class="param">
472
+
473
+ <li>
474
+
475
+ <span class='name'>format</span>
476
+
477
+
478
+ <span class='type'></span>
479
+
480
+
481
+ <em class="default">(defaults to: <tt>:yaml</tt>)</em>
482
+
483
+
484
+ &mdash;
485
+ <div class='inline'><p>The format to use.</p>
486
+ </div>
487
+
488
+ </li>
489
+
490
+ <li>
491
+
492
+ <span class='name'>must_raise</span>
493
+
494
+
495
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
496
+
497
+
498
+ <em class="default">(defaults to: <tt>true</tt>)</em>
499
+
500
+
501
+ &mdash;
502
+ <div class='inline'><p>If raise a Dump exception.</p>
503
+ </div>
504
+
505
+ </li>
506
+
507
+ </ul>
508
+
509
+ <p class="tag_title">Returns:</p>
510
+ <ul class="return">
511
+
512
+ <li>
513
+
514
+
515
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
516
+
517
+
518
+
519
+ &mdash;
520
+ <div class='inline'><p>The object inspected and formatted.</p>
521
+ </div>
522
+
523
+ </li>
524
+
525
+ </ul>
526
+
527
+ </div><table class="source_code">
528
+ <tr>
529
+ <td>
530
+ <pre class="lines">
531
+
532
+
533
+ 147
534
+ 148
535
+ 149
536
+ 150
537
+ 151
538
+ 152
539
+ 153
540
+ 154
541
+ 155
542
+ 156
543
+ 157
544
+ 158
545
+ 159
546
+ 160
547
+ 161</pre>
548
+ </td>
549
+ <td>
550
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 147</span>
551
+
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
+ <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>
554
+
555
+ <span class='kw'>begin</span>
556
+ <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>==</span> <span class='symbol'>:pretty_json</span> <span class='kw'>then</span>
557
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</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>
558
+ <span class='kw'>else</span>
559
+ <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_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>to_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
560
+ <span class='kw'>end</span>
561
+ <span class='kw'>rescue</span>
562
+ <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_inspect'>inspect</span>
563
+ <span class='kw'>end</span>
564
+
565
+ <span class='id identifier rubyid_must_raise'>must_raise</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'>Dump</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span>
566
+ <span class='kw'>end</span></pre>
567
+ </td>
568
+ </tr>
569
+ </table>
570
+ </div>
571
+
572
+ <div class="method_details ">
573
+ <h3 class="signature " id="ensure_array-instance_method">
574
+
575
+ - (<tt>Array</tt>) <strong>ensure_array</strong>
576
+
577
+
578
+
579
+
580
+
581
+ </h3><div class="docstring">
582
+ <div class="discussion">
583
+ <p>Makes sure that the object is an array. For non array objects, return a single element array containing the object.</p>
584
+
585
+
586
+ </div>
587
+ </div>
588
+ <div class="tags">
589
+
590
+ <p class="tag_title">Returns:</p>
591
+ <ul class="return">
592
+
593
+ <li>
594
+
595
+
596
+ <span class='type'>(<tt>Array</tt>)</span>
597
+
598
+
599
+
600
+ &mdash;
601
+ <div class='inline'><p>If the object is an array, then the object itself, a single element array containing the object otherwise.</p>
602
+ </div>
603
+
604
+ </li>
605
+
606
+ </ul>
607
+
608
+ </div><table class="source_code">
609
+ <tr>
610
+ <td>
611
+ <pre class="lines">
612
+
613
+
614
+ 54
615
+ 55
616
+ 56</pre>
617
+ </td>
618
+ <td>
619
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 54</span>
620
+
621
+ <span class='kw'>def</span> <span class='id identifier rubyid_ensure_array'>ensure_array</span>
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>
623
+ <span class='kw'>end</span></pre>
624
+ </td>
625
+ </tr>
626
+ </table>
627
+ </div>
628
+
629
+ <div class="method_details ">
630
+ <h3 class="signature " id="ensure_string-instance_method">
631
+
632
+ - (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>ensure_string</strong>
633
+
634
+
635
+
636
+
637
+
638
+ </h3><div class="docstring">
639
+ <div class="discussion">
640
+ <p>Makes sure that the object is a string. For <code>nil</code>, it returns &quot;&quot;.</p>
641
+
642
+
643
+ </div>
644
+ </div>
645
+ <div class="tags">
646
+
647
+ <p class="tag_title">Returns:</p>
648
+ <ul class="return">
649
+
650
+ <li>
651
+
652
+
653
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
654
+
655
+
656
+
657
+ &mdash;
658
+ <div class='inline'><p>The string representation of the object.</p>
659
+ </div>
660
+
661
+ </li>
662
+
663
+ </ul>
664
+
665
+ </div><table class="source_code">
666
+ <tr>
667
+ <td>
668
+ <pre class="lines">
669
+
670
+
671
+ 61
672
+ 62
673
+ 63</pre>
674
+ </td>
675
+ <td>
676
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 61</span>
677
+
678
+ <span class='kw'>def</span> <span class='id identifier rubyid_ensure_string'>ensure_string</span>
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>
680
+ <span class='kw'>end</span></pre>
681
+ </td>
682
+ </tr>
683
+ </table>
684
+ </div>
685
+
686
+ <div class="method_details ">
687
+ <h3 class="signature " id="format_boolean-instance_method">
688
+
689
+ - (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>format_boolean</strong>(true_name = nil, false_name = nil)
690
+
691
+
692
+
693
+
694
+
695
+ </h3><div class="docstring">
696
+ <div class="discussion">
697
+ <p>Formats a boolean.</p>
698
+
699
+
700
+ </div>
701
+ </div>
702
+ <div class="tags">
703
+ <p class="tag_title">Parameters:</p>
704
+ <ul class="param">
705
+
706
+ <li>
707
+
708
+ <span class='name'>true_name</span>
709
+
710
+
711
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
712
+
713
+
714
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
715
+
716
+
717
+ &mdash;
718
+ <div class='inline'><p>The string representation of <code>true</code>. Defaults to <code>Yes</code>.</p>
719
+ </div>
720
+
721
+ </li>
722
+
723
+ <li>
724
+
725
+ <span class='name'>false_name</span>
726
+
727
+
728
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
729
+
730
+
731
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
732
+
733
+
734
+ &mdash;
735
+ <div class='inline'><p>The string representation of <code>false</code>. Defaults to <code>No</code>.</p>
736
+ </div>
737
+
738
+ </li>
739
+
740
+ </ul>
741
+
742
+ <p class="tag_title">Returns:</p>
743
+ <ul class="return">
744
+
745
+ <li>
746
+
747
+
748
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
749
+
750
+
751
+
752
+ &mdash;
753
+ <div class='inline'><p>The string representation of the object.</p>
754
+ </div>
755
+
756
+ </li>
757
+
758
+ </ul>
759
+
760
+ <p class="tag_title">See Also:</p>
761
+ <ul class="see">
762
+
763
+ <li><span class='object_link'><a href="Settings.html#setup_boolean_names-instance_method" title="Lazier::Settings#setup_boolean_names (method)">Settings#setup_boolean_names</a></span></li>
764
+
765
+ </ul>
766
+
767
+ </div><table class="source_code">
768
+ <tr>
769
+ <td>
770
+ <pre class="lines">
771
+
772
+
773
+ 133
774
+ 134
775
+ 135
776
+ 136
777
+ 137
778
+ 138
779
+ 139
780
+ 140</pre>
781
+ </td>
782
+ <td>
783
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 133</span>
784
+
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
+ <span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='lbrace'>{</span>
787
+ <span class='kw'>true</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_true_name'>true_name</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><span class='lbracket'>[</span><span class='kw'>true</span><span class='rbracket'>]</span><span class='comma'>,</span>
788
+ <span class='kw'>false</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_false_name'>false_name</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><span class='lbracket'>[</span><span class='kw'>false</span><span class='rbracket'>]</span>
789
+ <span class='rbrace'>}</span>
790
+
791
+ <span class='id identifier rubyid_names'>names</span><span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_boolean'>to_boolean</span><span class='rbracket'>]</span>
792
+ <span class='kw'>end</span></pre>
793
+ </td>
794
+ </tr>
795
+ </table>
796
+ </div>
797
+
798
+ <div class="method_details ">
799
+ <h3 class="signature " id="format_number-instance_method">
800
+
801
+ - (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>format_number</strong>(prec = nil, decimal_separator = nil, add_string = nil, k_separator = nil)
802
+
803
+
804
+
805
+
806
+
807
+ </h3><div class="docstring">
808
+ <div class="discussion">
809
+ <p>Formats a number.</p>
810
+
811
+
812
+ </div>
813
+ </div>
814
+ <div class="tags">
815
+ <p class="tag_title">Parameters:</p>
816
+ <ul class="param">
817
+
818
+ <li>
819
+
820
+ <span class='name'>prec</span>
821
+
822
+
823
+ <span class='type'>(<tt>Fixnum</tt>)</span>
824
+
825
+
826
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
827
+
828
+
829
+ &mdash;
830
+ <div class='inline'><p>The precision to show.</p>
831
+ </div>
832
+
833
+ </li>
834
+
835
+ <li>
836
+
837
+ <span class='name'>decimal_separator</span>
838
+
839
+
840
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
841
+
842
+
843
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
844
+
845
+
846
+ &mdash;
847
+ <div class='inline'><p>The string to use as decimal separator.</p>
848
+ </div>
849
+
850
+ </li>
851
+
852
+ <li>
853
+
854
+ <span class='name'>add_string</span>
855
+
856
+
857
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
858
+
859
+
860
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
861
+
862
+
863
+ &mdash;
864
+ <div class='inline'><p>The string to append to the number.</p>
865
+ </div>
866
+
867
+ </li>
868
+
869
+ <li>
870
+
871
+ <span class='name'>k_separator</span>
872
+
873
+
874
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
875
+
876
+
877
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
878
+
879
+
880
+ &mdash;
881
+ <div class='inline'><p>The string to use as thousands separator.</p>
882
+ </div>
883
+
884
+ </li>
885
+
886
+ </ul>
887
+
888
+ <p class="tag_title">Returns:</p>
889
+ <ul class="return">
890
+
891
+ <li>
892
+
893
+
894
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
895
+
896
+
897
+
898
+ &mdash;
899
+ <div class='inline'><p>The string representation of the object.</p>
900
+ </div>
901
+
902
+ </li>
903
+
904
+ </ul>
905
+
906
+ <p class="tag_title">See Also:</p>
907
+ <ul class="see">
908
+
909
+ <li><span class='object_link'><a href="Settings.html#setup_format_number-instance_method" title="Lazier::Settings#setup_format_number (method)">Settings#setup_format_number</a></span></li>
910
+
911
+ </ul>
912
+
913
+ </div><table class="source_code">
914
+ <tr>
915
+ <td>
916
+ <pre class="lines">
917
+
918
+
919
+ 118
920
+ 119
921
+ 120
922
+ 121
923
+ 122
924
+ 123
925
+ 124
926
+ 125</pre>
927
+ </td>
928
+ <td>
929
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 118</span>
930
+
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
+ <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>
933
+ <span class='id identifier rubyid_decimal_separator'>decimal_separator</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'>:decimal_separator</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
934
+ <span class='id identifier rubyid_add_string'>add_string</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'>:add_string</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
935
+ <span class='id identifier rubyid_k_separator'>k_separator</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'>:k_separator</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
936
+
937
+ <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_to_currency'>number_to_currency</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:precision</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_prec'>prec</span><span class='comma'>,</span> <span class='symbol'>:separator</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_decimal_separator'>decimal_separator</span><span class='comma'>,</span> <span class='symbol'>:delimiter</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_k_separator'>k_separator</span><span class='comma'>,</span> <span class='symbol'>:format</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%n</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%n %u</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:unit</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span> <span class='id identifier rubyid_add_string'>add_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>nil</span>
938
+ <span class='kw'>end</span></pre>
939
+ </td>
940
+ </tr>
941
+ </table>
942
+ </div>
943
+
944
+ <div class="method_details ">
945
+ <h3 class="signature " id="is_boolean?-instance_method">
946
+
947
+ - (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>is_boolean?</strong>
948
+
949
+
950
+
951
+
952
+
953
+ </h3><div class="docstring">
954
+ <div class="discussion">
955
+ <p>Checks if the object is a valid boolean value.</p>
956
+
957
+
958
+ </div>
959
+ </div>
960
+ <div class="tags">
961
+
962
+ <p class="tag_title">Returns:</p>
963
+ <ul class="return">
964
+
965
+ <li>
966
+
967
+
968
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
969
+
970
+
971
+
972
+ &mdash;
973
+ <div class='inline'><p><code>true</code> is a valid boolean value, <code>false</code> otherwise.</p>
974
+ </div>
975
+
976
+ </li>
977
+
978
+ </ul>
979
+
980
+ </div><table class="source_code">
981
+ <tr>
982
+ <td>
983
+ <pre class="lines">
984
+
985
+
986
+ 47
987
+ 48
988
+ 49</pre>
989
+ </td>
990
+ <td>
991
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 47</span>
992
+
993
+ <span class='kw'>def</span> <span class='id identifier rubyid_is_boolean?'>is_boolean?</span>
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>
995
+ <span class='kw'>end</span></pre>
996
+ </td>
997
+ </tr>
998
+ </table>
999
+ </div>
1000
+
1001
+ <div class="method_details ">
1002
+ <h3 class="signature " id="is_float?-instance_method">
1003
+
1004
+ - (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>is_float?</strong>
1005
+
1006
+
1007
+
1008
+
1009
+
1010
+ </h3><div class="docstring">
1011
+ <div class="discussion">
1012
+ <p>Checks if the object is a valid float.</p>
1013
+
1014
+
1015
+ </div>
1016
+ </div>
1017
+ <div class="tags">
1018
+
1019
+ <p class="tag_title">Returns:</p>
1020
+ <ul class="return">
1021
+
1022
+ <li>
1023
+
1024
+
1025
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
1026
+
1027
+
1028
+
1029
+ &mdash;
1030
+ <div class='inline'><p><code>true</code> is a valid float, <code>false</code> otherwise.</p>
1031
+ </div>
1032
+
1033
+ </li>
1034
+
1035
+ </ul>
1036
+
1037
+ </div><table class="source_code">
1038
+ <tr>
1039
+ <td>
1040
+ <pre class="lines">
1041
+
1042
+
1043
+ 40
1044
+ 41
1045
+ 42</pre>
1046
+ </td>
1047
+ <td>
1048
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 40</span>
1049
+
1050
+ <span class='kw'>def</span> <span class='id identifier rubyid_is_float?'>is_float?</span>
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>
1052
+ <span class='kw'>end</span></pre>
1053
+ </td>
1054
+ </tr>
1055
+ </table>
1056
+ </div>
1057
+
1058
+ <div class="method_details ">
1059
+ <h3 class="signature " id="is_integer?-instance_method">
1060
+
1061
+ - (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>is_integer?</strong>
1062
+
1063
+
1064
+
1065
+
1066
+
1067
+ </h3><div class="docstring">
1068
+ <div class="discussion">
1069
+ <p>Checks if the object is a valid integer.</p>
1070
+
1071
+
1072
+ </div>
1073
+ </div>
1074
+ <div class="tags">
1075
+
1076
+ <p class="tag_title">Returns:</p>
1077
+ <ul class="return">
1078
+
1079
+ <li>
1080
+
1081
+
1082
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
1083
+
1084
+
1085
+
1086
+ &mdash;
1087
+ <div class='inline'><p><code>true</code> is a valid integer, <code>false</code> otherwise.</p>
1088
+ </div>
1089
+
1090
+ </li>
1091
+
1092
+ </ul>
1093
+
1094
+ </div><table class="source_code">
1095
+ <tr>
1096
+ <td>
1097
+ <pre class="lines">
1098
+
1099
+
1100
+ 33
1101
+ 34
1102
+ 35</pre>
1103
+ </td>
1104
+ <td>
1105
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 33</span>
1106
+
1107
+ <span class='kw'>def</span> <span class='id identifier rubyid_is_integer?'>is_integer?</span>
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>
1109
+ <span class='kw'>end</span></pre>
1110
+ </td>
1111
+ </tr>
1112
+ </table>
1113
+ </div>
1114
+
1115
+ <div class="method_details ">
1116
+ <h3 class="signature " id="is_number?-instance_method">
1117
+
1118
+ - (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>is_number?</strong>
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+ </h3><div class="docstring">
1125
+ <div class="discussion">
1126
+ <p>Checks if the object is a valid number.</p>
1127
+
1128
+
1129
+ </div>
1130
+ </div>
1131
+ <div class="tags">
1132
+
1133
+ <p class="tag_title">Returns:</p>
1134
+ <ul class="return">
1135
+
1136
+ <li>
1137
+
1138
+
1139
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
1140
+
1141
+
1142
+
1143
+ &mdash;
1144
+ <div class='inline'><p><code>true</code> is a valid number, <code>false</code> otherwise.</p>
1145
+ </div>
1146
+
1147
+ </li>
1148
+
1149
+ </ul>
1150
+
1151
+ </div><table class="source_code">
1152
+ <tr>
1153
+ <td>
1154
+ <pre class="lines">
1155
+
1156
+
1157
+ 26
1158
+ 27
1159
+ 28</pre>
1160
+ </td>
1161
+ <td>
1162
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 26</span>
1163
+
1164
+ <span class='kw'>def</span> <span class='id identifier rubyid_is_number?'>is_number?</span>
1165
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_float?'>is_float?</span>
1166
+ <span class='kw'>end</span></pre>
1167
+ </td>
1168
+ </tr>
1169
+ </table>
1170
+ </div>
1171
+
1172
+ <div class="method_details ">
1173
+ <h3 class="signature " id="normalize_number-instance_method">
1174
+
1175
+ - (<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>) <strong>normalize_number</strong>
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+ </h3><div class="docstring">
1182
+ <div class="discussion">
1183
+ <p>Normalizes a number for conversion. Basically this methods removes all separator and ensures that <code>.</code> is used for decimal separator.</p>
1184
+
1185
+
1186
+ </div>
1187
+ </div>
1188
+ <div class="tags">
1189
+
1190
+ <p class="tag_title">Returns:</p>
1191
+ <ul class="return">
1192
+
1193
+ <li>
1194
+
1195
+
1196
+ <span class='type'>(<tt><span class='object_link'><a href="String.html" title="Lazier::String (module)">String</a></span></tt>)</span>
1197
+
1198
+
1199
+
1200
+ &mdash;
1201
+ <div class='inline'><p>The normalized number.</p>
1202
+ </div>
1203
+
1204
+ </li>
1205
+
1206
+ </ul>
1207
+
1208
+ </div><table class="source_code">
1209
+ <tr>
1210
+ <td>
1211
+ <pre class="lines">
1212
+
1213
+
1214
+ 16
1215
+ 17
1216
+ 18
1217
+ 19
1218
+ 20
1219
+ 21</pre>
1220
+ </td>
1221
+ <td>
1222
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 16</span>
1223
+
1224
+ <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>
1229
+ <span class='kw'>end</span></pre>
1230
+ </td>
1231
+ </tr>
1232
+ </table>
1233
+ </div>
1234
+
1235
+ <div class="method_details ">
1236
+ <h3 class="signature " id="round_to_precision-instance_method">
1237
+
1238
+ - (<tt>Float</tt>) <strong>round_to_precision</strong>(prec = 2)
1239
+
1240
+
1241
+
1242
+
1243
+
1244
+ </h3><div class="docstring">
1245
+ <div class="discussion">
1246
+ <p>Returns the rounded float representaton of the object.</p>
1247
+
1248
+
1249
+ </div>
1250
+ </div>
1251
+ <div class="tags">
1252
+ <p class="tag_title">Parameters:</p>
1253
+ <ul class="param">
1254
+
1255
+ <li>
1256
+
1257
+ <span class='name'>prec</span>
1258
+
1259
+
1260
+ <span class='type'>(<tt>Fixnum</tt>)</span>
1261
+
1262
+
1263
+ <em class="default">(defaults to: <tt>2</tt>)</em>
1264
+
1265
+
1266
+ &mdash;
1267
+ <div class='inline'><p>The precision to keep.</p>
1268
+ </div>
1269
+
1270
+ </li>
1271
+
1272
+ </ul>
1273
+
1274
+ <p class="tag_title">Returns:</p>
1275
+ <ul class="return">
1276
+
1277
+ <li>
1278
+
1279
+
1280
+ <span class='type'>(<tt>Float</tt>)</span>
1281
+
1282
+
1283
+
1284
+ &mdash;
1285
+ <div class='inline'><p>The rounded float representaton of the object.</p>
1286
+ </div>
1287
+
1288
+ </li>
1289
+
1290
+ </ul>
1291
+
1292
+ </div><table class="source_code">
1293
+ <tr>
1294
+ <td>
1295
+ <pre class="lines">
1296
+
1297
+
1298
+ 106
1299
+ 107
1300
+ 108</pre>
1301
+ </td>
1302
+ <td>
1303
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 106</span>
1304
+
1305
+ <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
+ <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>
1307
+ <span class='kw'>end</span></pre>
1308
+ </td>
1309
+ </tr>
1310
+ </table>
1311
+ </div>
1312
+
1313
+ <div class="method_details ">
1314
+ <h3 class="signature " id="to_boolean-instance_method">
1315
+
1316
+ - (<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>) <strong>to_boolean</strong>
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+ </h3><div class="docstring">
1323
+ <div class="discussion">
1324
+ <p>Converts the object to a boolean.</p>
1325
+
1326
+
1327
+ </div>
1328
+ </div>
1329
+ <div class="tags">
1330
+
1331
+ <p class="tag_title">Returns:</p>
1332
+ <ul class="return">
1333
+
1334
+ <li>
1335
+
1336
+
1337
+ <span class='type'>(<tt><span class='object_link'><a href="Boolean.html" title="Lazier::Boolean (module)">Boolean</a></span></tt>)</span>
1338
+
1339
+
1340
+
1341
+ &mdash;
1342
+ <div class='inline'><p>The boolean representation of the object.</p>
1343
+ </div>
1344
+
1345
+ </li>
1346
+
1347
+ </ul>
1348
+
1349
+ </div><table class="source_code">
1350
+ <tr>
1351
+ <td>
1352
+ <pre class="lines">
1353
+
1354
+
1355
+ 96
1356
+ 97
1357
+ 98
1358
+ 99
1359
+ 100</pre>
1360
+ </td>
1361
+ <td>
1362
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 96</span>
1363
+
1364
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_boolean'>to_boolean</span>
1365
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span>
1366
+ <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_to_i'>to_i</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</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>
1367
+ <span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><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='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(1|on|true|yes|t|y)$</span><span class='regexp_end'>/i</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_rv'>rv</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='rparen'>)</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
1368
+ <span class='kw'>end</span></pre>
1369
+ </td>
1370
+ </tr>
1371
+ </table>
1372
+ </div>
1373
+
1374
+ <div class="method_details ">
1375
+ <h3 class="signature " id="to_float-instance_method">
1376
+
1377
+ - (<tt>Float</tt>) <strong>to_float</strong>(default_value = 0.0)
1378
+
1379
+
1380
+
1381
+
1382
+
1383
+ </h3><div class="docstring">
1384
+ <div class="discussion">
1385
+ <p>Converts the object to a float.</p>
1386
+
1387
+
1388
+ </div>
1389
+ </div>
1390
+ <div class="tags">
1391
+ <p class="tag_title">Parameters:</p>
1392
+ <ul class="param">
1393
+
1394
+ <li>
1395
+
1396
+ <span class='name'>default_value</span>
1397
+
1398
+
1399
+ <span class='type'>(<tt>Float</tt>)</span>
1400
+
1401
+
1402
+ <em class="default">(defaults to: <tt>0.0</tt>)</em>
1403
+
1404
+
1405
+ &mdash;
1406
+ <div class='inline'><p>The value to return if the conversion is not possible.</p>
1407
+ </div>
1408
+
1409
+ </li>
1410
+
1411
+ </ul>
1412
+
1413
+ <p class="tag_title">Returns:</p>
1414
+ <ul class="return">
1415
+
1416
+ <li>
1417
+
1418
+
1419
+ <span class='type'>(<tt>Float</tt>)</span>
1420
+
1421
+
1422
+
1423
+ &mdash;
1424
+ <div class='inline'><p>The float representation of the object.</p>
1425
+ </div>
1426
+
1427
+ </li>
1428
+
1429
+ </ul>
1430
+
1431
+ </div><table class="source_code">
1432
+ <tr>
1433
+ <td>
1434
+ <pre class="lines">
1435
+
1436
+
1437
+ 69
1438
+ 70
1439
+ 71
1440
+ 72
1441
+ 73
1442
+ 74
1443
+ 75
1444
+ 76
1445
+ 77</pre>
1446
+ </td>
1447
+ <td>
1448
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 69</span>
1449
+
1450
+ <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
+ <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>
1452
+ <span class='kw'>self</span>
1453
+ <span class='kw'>elsif</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>
1454
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
1455
+ <span class='kw'>else</span>
1456
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_float?'>is_float?</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>Kernel</span><span class='period'>.</span><span class='const'>Float</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_normalize_number'>normalize_number</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_default_value'>default_value</span>
1457
+ <span class='kw'>end</span>
1458
+ <span class='kw'>end</span></pre>
1459
+ </td>
1460
+ </tr>
1461
+ </table>
1462
+ </div>
1463
+
1464
+ <div class="method_details ">
1465
+ <h3 class="signature " id="to_integer-instance_method">
1466
+
1467
+ - (<tt>Fixnum</tt>) <strong>to_integer</strong>(default_value = 0)
1468
+
1469
+
1470
+
1471
+
1472
+
1473
+ </h3><div class="docstring">
1474
+ <div class="discussion">
1475
+ <p>Converts the object to a integer.</p>
1476
+
1477
+
1478
+ </div>
1479
+ </div>
1480
+ <div class="tags">
1481
+ <p class="tag_title">Parameters:</p>
1482
+ <ul class="param">
1483
+
1484
+ <li>
1485
+
1486
+ <span class='name'>default_value</span>
1487
+
1488
+
1489
+ <span class='type'>(<tt>Fixnum</tt>)</span>
1490
+
1491
+
1492
+ <em class="default">(defaults to: <tt>0</tt>)</em>
1493
+
1494
+
1495
+ &mdash;
1496
+ <div class='inline'><p>The value to return if the conversion is not possible.</p>
1497
+ </div>
1498
+
1499
+ </li>
1500
+
1501
+ </ul>
1502
+
1503
+ <p class="tag_title">Returns:</p>
1504
+ <ul class="return">
1505
+
1506
+ <li>
1507
+
1508
+
1509
+ <span class='type'>(<tt>Fixnum</tt>)</span>
1510
+
1511
+
1512
+
1513
+ &mdash;
1514
+ <div class='inline'><p>The integer representation of the object.</p>
1515
+ </div>
1516
+
1517
+ </li>
1518
+
1519
+ </ul>
1520
+
1521
+ </div><table class="source_code">
1522
+ <tr>
1523
+ <td>
1524
+ <pre class="lines">
1525
+
1526
+
1527
+ 83
1528
+ 84
1529
+ 85
1530
+ 86
1531
+ 87
1532
+ 88
1533
+ 89
1534
+ 90
1535
+ 91</pre>
1536
+ </td>
1537
+ <td>
1538
+ <pre class="code"><span class="info file"># File 'lib/lazier/object.rb', line 83</span>
1539
+
1540
+ <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
+ <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>
1542
+ <span class='kw'>self</span>
1543
+ <span class='kw'>elsif</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>
1544
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
1545
+ <span class='kw'>else</span>
1546
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_integer?'>is_integer?</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>Kernel</span><span class='period'>.</span><span class='const'>Integer</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> <span class='op'>:</span> <span class='id identifier rubyid_default_value'>default_value</span>
1547
+ <span class='kw'>end</span>
1548
+ <span class='kw'>end</span></pre>
1549
+ </td>
1550
+ </tr>
1551
+ </table>
1552
+ </div>
1553
+
1554
+ </div>
1555
+
1556
+ </div>
1557
+
1558
+ <div id="footer">
1559
+ Generated on Wed Aug 1 08:57:55 2012 by
1560
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1561
+ 0.8.2.1 (ruby-1.9.2).
1562
+ </div>
1563
+
1564
+ </body>
1565
+ </html>