classx 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/ChangeLog +408 -2
  2. data/README +2 -2
  3. data/Rakefile +4 -3
  4. data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-block_rb.html +1 -1
  5. data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-callbacks_rb.html +1 -1
  6. data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-change_rb.html +1 -1
  7. data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-hunk_rb.html +1 -1
  8. data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs_rb.html +1 -1
  9. data/doc/output/coverage/-Library-Ruby-Gems-gems-rcov-0_8_1_2_0-lib-rcov_rb.html +1 -1
  10. data/doc/output/coverage/index.html +37 -172
  11. data/doc/output/coverage/lib-classx-attribute_rb.html +788 -0
  12. data/doc/output/coverage/{-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-drb-invokemethod_rb.html → lib-classx-attributes_rb.html} +96 -47
  13. data/doc/output/coverage/lib-classx-validate_rb.html +36 -36
  14. data/doc/output/coverage/lib-classx_rb.html +74 -151
  15. data/example/commandable.rb +28 -0
  16. data/lib/classx.rb +35 -112
  17. data/lib/classx/attribute.rb +178 -0
  18. data/lib/classx/attributes.rb +80 -8
  19. data/lib/classx/commandable.rb +38 -0
  20. data/lib/classx/validate.rb +1 -1
  21. data/spec/classx/default_option_spec.rb +140 -0
  22. data/spec/classx/handles_spec.rb +44 -0
  23. data/spec/classx/with_coerce.rb +79 -0
  24. data/spec/classx/with_extend.rb +25 -0
  25. data/spec/classx/with_include.rb +25 -0
  26. data/spec/classx/with_multiple_class_spec.rb +23 -0
  27. data/spec/classx/without_accessor_spec.rb +26 -0
  28. data/spec/classx/without_anyoption_spec.rb +23 -0
  29. data/spec/classx/writable_option_spec.rb +73 -0
  30. data/spec/classx_attributes_spec.rb +30 -0
  31. data/tasks/basic_config.rake +5 -1
  32. metadata +22 -15
  33. data/doc/output/coverage/-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-drb-drb_rb.html +0 -2373
  34. data/doc/output/coverage/-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-drb-eq_rb.html +0 -626
  35. data/doc/output/coverage/-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-forwardable_rb.html +0 -828
  36. data/doc/output/coverage/-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-pp_rb.html +0 -1257
  37. data/doc/output/coverage/-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-prettyprint_rb.html +0 -1506
  38. data/doc/output/coverage/-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-timeout_rb.html +0 -715
  39. data/lib/classx.rb.new +0 -102
  40. data/spec/classx_spec.rb +0 -261
@@ -553,7 +553,7 @@ span.run100 {
553
553
  </style>
554
554
  </head>
555
555
  <body><h3>C0 code coverage information</h3>
556
- <p>Generated on Wed May 28 01:22:12 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
556
+ <p>Generated on Thu Aug 21 17:23:11 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
557
557
  </p>
558
558
  <hr/>
559
559
  <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
@@ -553,7 +553,7 @@ span.run100 {
553
553
  </style>
554
554
  </head>
555
555
  <body><h3>C0 code coverage information</h3>
556
- <p>Generated on Wed May 28 01:22:12 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
556
+ <p>Generated on Thu Aug 21 17:23:11 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
557
557
  </p>
558
558
  <hr/>
559
559
  <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
@@ -553,7 +553,7 @@ span.run100 {
553
553
  </style>
554
554
  </head>
555
555
  <body><h3>C0 code coverage information</h3>
556
- <p>Generated on Wed May 28 01:22:12 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
556
+ <p>Generated on Thu Aug 21 17:23:12 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
557
557
  </p>
558
558
  <hr/>
559
559
  <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
@@ -553,7 +553,7 @@ span.run100 {
553
553
  </style>
554
554
  </head>
555
555
  <body><h3>C0 code coverage information</h3>
556
- <p>Generated on Wed May 28 01:22:12 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
556
+ <p>Generated on Thu Aug 21 17:23:11 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
557
557
  </p>
558
558
  <hr/>
559
559
  <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
@@ -553,7 +553,7 @@ span.run100 {
553
553
  </style>
554
554
  </head>
555
555
  <body><h3>C0 code coverage information</h3>
556
- <p>Generated on Wed May 28 01:22:13 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
556
+ <p>Generated on Thu Aug 21 17:23:12 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
557
557
  </p>
558
558
  <hr/>
559
559
  <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
@@ -148,7 +148,7 @@ table.report tr.dark {
148
148
  </script>
149
149
  </head>
150
150
  <body><h3>C0 code coverage information</h3>
151
- <p>Generated on Wed May 28 01:22:11 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
151
+ <p>Generated on Thu Aug 21 17:23:10 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
152
152
  </p>
153
153
  <hr/>
154
154
  <table class='report'><thead><tr><td class='heading'>Name</td>
@@ -159,24 +159,24 @@ table.report tr.dark {
159
159
  </tr>
160
160
  </thead>
161
161
  <tbody><tr class='light'><td>TOTAL</td>
162
- <td class='lines_total'><tt>6750</tt>
162
+ <td class='lines_total'><tt>3255</tt>
163
163
  </td>
164
- <td class='lines_code'><tt>3833</tt>
164
+ <td class='lines_code'><tt>1819</tt>
165
165
  </td>
166
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>43.7%</tt>
166
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>39.2%</tt>
167
167
  &nbsp;</td>
168
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='44'/>
169
- <td class='uncovered' width='56'/>
168
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='39'/>
169
+ <td class='uncovered' width='61'/>
170
170
  </tr>
171
171
  </table>
172
172
  </td>
173
173
  </tr>
174
174
  </table>
175
175
  </td>
176
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>16.3%</tt>
176
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>18.6%</tt>
177
177
  &nbsp;</td>
178
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='16'/>
179
- <td class='uncovered' width='84'/>
178
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='19'/>
179
+ <td class='uncovered' width='81'/>
180
180
  </tr>
181
181
  </table>
182
182
  </td>
@@ -346,161 +346,26 @@ table.report tr.dark {
346
346
  </table>
347
347
  </td>
348
348
  </tr>
349
- <tr class='dark'><td><a href='-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-drb-drb_rb.html'>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/drb.rb</a>
349
+ <tr class='dark'><td><a href='lib-classx_rb.html'>lib/classx.rb</a>
350
350
  </td>
351
- <td class='lines_total'><tt>1763</tt>
351
+ <td class='lines_total'><tt>65</tt>
352
352
  </td>
353
- <td class='lines_code'><tt>861</tt>
353
+ <td class='lines_code'><tt>49</tt>
354
354
  </td>
355
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>61.9%</tt>
356
- &nbsp;</td>
357
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='62'/>
358
- <td class='uncovered' width='38'/>
359
- </tr>
360
- </table>
361
- </td>
362
- </tr>
363
- </table>
364
- </td>
365
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>24.0%</tt>
366
- &nbsp;</td>
367
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='24'/>
368
- <td class='uncovered' width='76'/>
369
- </tr>
370
- </table>
371
- </td>
372
- </tr>
373
- </table>
374
- </td>
375
- </tr>
376
- <tr class='light'><td><a href='-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-drb-eq_rb.html'>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/eq.rb</a>
377
- </td>
378
- <td class='lines_total'><tt>16</tt>
379
- </td>
380
- <td class='lines_code'><tt>13</tt>
381
- </td>
382
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>68.8%</tt>
383
- &nbsp;</td>
384
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='69'/>
385
- <td class='uncovered' width='31'/>
386
- </tr>
387
- </table>
388
- </td>
389
- </tr>
390
- </table>
391
- </td>
392
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>61.5%</tt>
393
- &nbsp;</td>
394
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='62'/>
395
- <td class='uncovered' width='38'/>
396
- </tr>
397
- </table>
398
- </td>
399
- </tr>
400
- </table>
401
- </td>
402
- </tr>
403
- <tr class='dark'><td><a href='-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-drb-invokemethod_rb.html'>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/drb/invokemethod.rb</a>
404
- </td>
405
- <td class='lines_total'><tt>36</tt>
406
- </td>
407
- <td class='lines_code'><tt>33</tt>
408
- </td>
409
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>22.2%</tt>
410
- &nbsp;</td>
411
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='22'/>
412
- <td class='uncovered' width='78'/>
413
- </tr>
414
- </table>
415
- </td>
416
- </tr>
417
- </table>
418
- </td>
419
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>15.2%</tt>
420
- &nbsp;</td>
421
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='15'/>
422
- <td class='uncovered' width='85'/>
423
- </tr>
424
- </table>
425
- </td>
426
- </tr>
427
- </table>
428
- </td>
429
- </tr>
430
- <tr class='light'><td><a href='-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-forwardable_rb.html'>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/forwardable.rb</a>
431
- </td>
432
- <td class='lines_total'><tt>218</tt>
433
- </td>
434
- <td class='lines_code'><tt>50</tt>
435
- </td>
436
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>82.6%</tt>
437
- &nbsp;</td>
438
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='83'/>
439
- <td class='uncovered' width='17'/>
440
- </tr>
441
- </table>
442
- </td>
443
- </tr>
444
- </table>
445
- </td>
446
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>32.0%</tt>
447
- &nbsp;</td>
448
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='32'/>
449
- <td class='uncovered' width='68'/>
450
- </tr>
451
- </table>
452
- </td>
453
- </tr>
454
- </table>
455
- </td>
456
- </tr>
457
- <tr class='dark'><td><a href='-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-pp_rb.html'>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pp.rb</a>
458
- </td>
459
- <td class='lines_total'><tt>647</tt>
460
- </td>
461
- <td class='lines_code'><tt>452</tt>
462
- </td>
463
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>34.8%</tt>
464
- &nbsp;</td>
465
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='35'/>
466
- <td class='uncovered' width='65'/>
467
- </tr>
468
- </table>
469
- </td>
470
- </tr>
471
- </table>
472
- </td>
473
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>13.7%</tt>
474
- &nbsp;</td>
475
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='14'/>
476
- <td class='uncovered' width='86'/>
477
- </tr>
478
- </table>
479
- </td>
480
- </tr>
481
- </table>
482
- </td>
483
- </tr>
484
- <tr class='light'><td><a href='-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-prettyprint_rb.html'>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/prettyprint.rb</a>
485
- </td>
486
- <td class='lines_total'><tt>896</tt>
487
- </td>
488
- <td class='lines_code'><tt>706</tt>
489
- </td>
490
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>21.0%</tt>
355
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>100.0%</tt>
491
356
  &nbsp;</td>
492
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='21'/>
493
- <td class='uncovered' width='79'/>
357
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/>
358
+ <td class='uncovered' width='0'/>
494
359
  </tr>
495
360
  </table>
496
361
  </td>
497
362
  </tr>
498
363
  </table>
499
364
  </td>
500
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>6.5%</tt>
365
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>100.0%</tt>
501
366
  &nbsp;</td>
502
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='7'/>
503
- <td class='uncovered' width='93'/>
367
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='100'/>
368
+ <td class='uncovered' width='0'/>
504
369
  </tr>
505
370
  </table>
506
371
  </td>
@@ -508,26 +373,26 @@ table.report tr.dark {
508
373
  </table>
509
374
  </td>
510
375
  </tr>
511
- <tr class='dark'><td><a href='-System-Library-Frameworks-Ruby_framework-Versions-1_8-usr-lib-ruby-1_8-timeout_rb.html'>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb</a>
376
+ <tr class='light'><td><a href='lib-classx-attribute_rb.html'>lib/classx/attribute.rb</a>
512
377
  </td>
513
- <td class='lines_total'><tt>105</tt>
378
+ <td class='lines_total'><tt>178</tt>
514
379
  </td>
515
- <td class='lines_code'><tt>43</tt>
380
+ <td class='lines_code'><tt>142</tt>
516
381
  </td>
517
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>67.6%</tt>
382
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>52.8%</tt>
518
383
  &nbsp;</td>
519
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='68'/>
520
- <td class='uncovered' width='32'/>
384
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='53'/>
385
+ <td class='uncovered' width='47'/>
521
386
  </tr>
522
387
  </table>
523
388
  </td>
524
389
  </tr>
525
390
  </table>
526
391
  </td>
527
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>23.3%</tt>
392
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>45.1%</tt>
528
393
  &nbsp;</td>
529
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='23'/>
530
- <td class='uncovered' width='77'/>
394
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='45'/>
395
+ <td class='uncovered' width='55'/>
531
396
  </tr>
532
397
  </table>
533
398
  </td>
@@ -535,26 +400,26 @@ table.report tr.dark {
535
400
  </table>
536
401
  </td>
537
402
  </tr>
538
- <tr class='light'><td><a href='lib-classx_rb.html'>lib/classx.rb</a>
403
+ <tr class='dark'><td><a href='lib-classx-attributes_rb.html'>lib/classx/attributes.rb</a>
539
404
  </td>
540
- <td class='lines_total'><tt>142</tt>
405
+ <td class='lines_total'><tt>85</tt>
541
406
  </td>
542
- <td class='lines_code'><tt>117</tt>
407
+ <td class='lines_code'><tt>70</tt>
543
408
  </td>
544
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>97.2%</tt>
409
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>95.3%</tt>
545
410
  &nbsp;</td>
546
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='97'/>
547
- <td class='uncovered' width='3'/>
411
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='95'/>
412
+ <td class='uncovered' width='5'/>
548
413
  </tr>
549
414
  </table>
550
415
  </td>
551
416
  </tr>
552
417
  </table>
553
418
  </td>
554
- <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>96.6%</tt>
419
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>94.3%</tt>
555
420
  &nbsp;</td>
556
- <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='97'/>
557
- <td class='uncovered' width='3'/>
421
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='94'/>
422
+ <td class='uncovered' width='6'/>
558
423
  </tr>
559
424
  </table>
560
425
  </td>
@@ -562,7 +427,7 @@ table.report tr.dark {
562
427
  </table>
563
428
  </td>
564
429
  </tr>
565
- <tr class='dark'><td><a href='lib-classx-validate_rb.html'>lib/classx/validate.rb</a>
430
+ <tr class='light'><td><a href='lib-classx-validate_rb.html'>lib/classx/validate.rb</a>
566
431
  </td>
567
432
  <td class='lines_total'><tt>35</tt>
568
433
  </td>
@@ -0,0 +1,788 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>lib/classx/attribute.rb - C0 code coverage information</title>
3
+ <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
4
+ <style type='text/css'>span.cross-ref-title {
5
+ font-size: 140%;
6
+ }
7
+ span.cross-ref a {
8
+ text-decoration: none;
9
+ }
10
+ span.cross-ref {
11
+ background-color:#f3f7fa;
12
+ border: 1px dashed #333;
13
+ margin: 1em;
14
+ padding: 0.5em;
15
+ overflow: hidden;
16
+ }
17
+ a.crossref-toggle {
18
+ text-decoration: none;
19
+ }
20
+ span.marked0 {
21
+ background-color: rgb(185, 210, 200);
22
+ display: block;
23
+ }
24
+ span.marked1 {
25
+ background-color: rgb(190, 215, 205);
26
+ display: block;
27
+ }
28
+ span.inferred0 {
29
+ background-color: rgb(175, 200, 200);
30
+ display: block;
31
+ }
32
+ span.inferred1 {
33
+ background-color: rgb(180, 205, 205);
34
+ display: block;
35
+ }
36
+ span.uncovered0 {
37
+ background-color: rgb(225, 110, 110);
38
+ display: block;
39
+ }
40
+ span.uncovered1 {
41
+ background-color: rgb(235, 120, 120);
42
+ display: block;
43
+ }
44
+ span.overview {
45
+ border-bottom: 8px solid black;
46
+ }
47
+ div.overview {
48
+ border-bottom: 8px solid black;
49
+ }
50
+ body {
51
+ font-family: verdana, arial, helvetica;
52
+ }
53
+ div.footer {
54
+ font-size: 68%;
55
+ margin-top: 1.5em;
56
+ }
57
+ h1, h2, h3, h4, h5, h6 {
58
+ margin-bottom: 0.5em;
59
+ }
60
+ h5 {
61
+ margin-top: 0.5em;
62
+ }
63
+ .hidden {
64
+ display: none;
65
+ }
66
+ div.separator {
67
+ height: 10px;
68
+ }
69
+ /* Commented out for better readability, esp. on IE */
70
+ /*
71
+ table tr td, table tr th {
72
+ font-size: 68%;
73
+ }
74
+ td.value table tr td {
75
+ font-size: 11px;
76
+ }
77
+ */
78
+ table.percent_graph {
79
+ height: 12px;
80
+ border: #808080 1px solid;
81
+ empty-cells: show;
82
+ }
83
+ table.percent_graph td.covered {
84
+ height: 10px;
85
+ background: #00f000;
86
+ }
87
+ table.percent_graph td.uncovered {
88
+ height: 10px;
89
+ background: #e00000;
90
+ }
91
+ table.percent_graph td.NA {
92
+ height: 10px;
93
+ background: #eaeaea;
94
+ }
95
+ table.report {
96
+ border-collapse: collapse;
97
+ width: 100%;
98
+ }
99
+ table.report td.heading {
100
+ background: #dcecff;
101
+ border: #d0d0d0 1px solid;
102
+ font-weight: bold;
103
+ text-align: center;
104
+ }
105
+ table.report td.heading:hover {
106
+ background: #c0ffc0;
107
+ }
108
+ table.report td.text {
109
+ border: #d0d0d0 1px solid;
110
+ }
111
+ table.report td.value,
112
+ table.report td.lines_total,
113
+ table.report td.lines_code {
114
+ text-align: right;
115
+ border: #d0d0d0 1px solid;
116
+ }
117
+ table.report tr.light {
118
+ background-color: rgb(240, 240, 245);
119
+ }
120
+ table.report tr.dark {
121
+ background-color: rgb(230, 230, 235);
122
+ }
123
+ </style>
124
+ <script type='text/javascript'>
125
+ // <![CDATA[
126
+ function toggleCode( id ) {
127
+ if ( document.getElementById )
128
+ elem = document.getElementById( id );
129
+ else if ( document.all )
130
+ elem = eval( "document.all." + id );
131
+ else
132
+ return false;
133
+
134
+ elemStyle = elem.style;
135
+
136
+ if ( elemStyle.display != "block" ) {
137
+ elemStyle.display = "block"
138
+ } else {
139
+ elemStyle.display = "none"
140
+ }
141
+
142
+ return true;
143
+ }
144
+
145
+ // Make cross-references hidden by default
146
+ document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
147
+ // ]]>
148
+ </script>
149
+ <style type='text/css'>span.run0 {
150
+ background-color: rgb(178, 204, 255);
151
+ display: block;
152
+ }
153
+ span.run1 {
154
+ background-color: rgb(178, 206, 255);
155
+ display: block;
156
+ }
157
+ span.run2 {
158
+ background-color: rgb(178, 209, 255);
159
+ display: block;
160
+ }
161
+ span.run3 {
162
+ background-color: rgb(178, 211, 255);
163
+ display: block;
164
+ }
165
+ span.run4 {
166
+ background-color: rgb(178, 214, 255);
167
+ display: block;
168
+ }
169
+ span.run5 {
170
+ background-color: rgb(178, 218, 255);
171
+ display: block;
172
+ }
173
+ span.run6 {
174
+ background-color: rgb(178, 220, 255);
175
+ display: block;
176
+ }
177
+ span.run7 {
178
+ background-color: rgb(178, 223, 255);
179
+ display: block;
180
+ }
181
+ span.run8 {
182
+ background-color: rgb(178, 225, 255);
183
+ display: block;
184
+ }
185
+ span.run9 {
186
+ background-color: rgb(178, 228, 255);
187
+ display: block;
188
+ }
189
+ span.run10 {
190
+ background-color: rgb(178, 232, 255);
191
+ display: block;
192
+ }
193
+ span.run11 {
194
+ background-color: rgb(178, 234, 255);
195
+ display: block;
196
+ }
197
+ span.run12 {
198
+ background-color: rgb(178, 237, 255);
199
+ display: block;
200
+ }
201
+ span.run13 {
202
+ background-color: rgb(178, 239, 255);
203
+ display: block;
204
+ }
205
+ span.run14 {
206
+ background-color: rgb(178, 242, 255);
207
+ display: block;
208
+ }
209
+ span.run15 {
210
+ background-color: rgb(178, 246, 255);
211
+ display: block;
212
+ }
213
+ span.run16 {
214
+ background-color: rgb(178, 248, 255);
215
+ display: block;
216
+ }
217
+ span.run17 {
218
+ background-color: rgb(178, 251, 255);
219
+ display: block;
220
+ }
221
+ span.run18 {
222
+ background-color: rgb(178, 253, 255);
223
+ display: block;
224
+ }
225
+ span.run19 {
226
+ background-color: rgb(178, 255, 253);
227
+ display: block;
228
+ }
229
+ span.run20 {
230
+ background-color: rgb(178, 255, 249);
231
+ display: block;
232
+ }
233
+ span.run21 {
234
+ background-color: rgb(178, 255, 247);
235
+ display: block;
236
+ }
237
+ span.run22 {
238
+ background-color: rgb(178, 255, 244);
239
+ display: block;
240
+ }
241
+ span.run23 {
242
+ background-color: rgb(178, 255, 242);
243
+ display: block;
244
+ }
245
+ span.run24 {
246
+ background-color: rgb(178, 255, 239);
247
+ display: block;
248
+ }
249
+ span.run25 {
250
+ background-color: rgb(178, 255, 235);
251
+ display: block;
252
+ }
253
+ span.run26 {
254
+ background-color: rgb(178, 255, 233);
255
+ display: block;
256
+ }
257
+ span.run27 {
258
+ background-color: rgb(178, 255, 230);
259
+ display: block;
260
+ }
261
+ span.run28 {
262
+ background-color: rgb(178, 255, 228);
263
+ display: block;
264
+ }
265
+ span.run29 {
266
+ background-color: rgb(178, 255, 225);
267
+ display: block;
268
+ }
269
+ span.run30 {
270
+ background-color: rgb(178, 255, 221);
271
+ display: block;
272
+ }
273
+ span.run31 {
274
+ background-color: rgb(178, 255, 219);
275
+ display: block;
276
+ }
277
+ span.run32 {
278
+ background-color: rgb(178, 255, 216);
279
+ display: block;
280
+ }
281
+ span.run33 {
282
+ background-color: rgb(178, 255, 214);
283
+ display: block;
284
+ }
285
+ span.run34 {
286
+ background-color: rgb(178, 255, 211);
287
+ display: block;
288
+ }
289
+ span.run35 {
290
+ background-color: rgb(178, 255, 207);
291
+ display: block;
292
+ }
293
+ span.run36 {
294
+ background-color: rgb(178, 255, 205);
295
+ display: block;
296
+ }
297
+ span.run37 {
298
+ background-color: rgb(178, 255, 202);
299
+ display: block;
300
+ }
301
+ span.run38 {
302
+ background-color: rgb(178, 255, 200);
303
+ display: block;
304
+ }
305
+ span.run39 {
306
+ background-color: rgb(178, 255, 197);
307
+ display: block;
308
+ }
309
+ span.run40 {
310
+ background-color: rgb(178, 255, 193);
311
+ display: block;
312
+ }
313
+ span.run41 {
314
+ background-color: rgb(178, 255, 191);
315
+ display: block;
316
+ }
317
+ span.run42 {
318
+ background-color: rgb(178, 255, 188);
319
+ display: block;
320
+ }
321
+ span.run43 {
322
+ background-color: rgb(178, 255, 186);
323
+ display: block;
324
+ }
325
+ span.run44 {
326
+ background-color: rgb(178, 255, 183);
327
+ display: block;
328
+ }
329
+ span.run45 {
330
+ background-color: rgb(178, 255, 179);
331
+ display: block;
332
+ }
333
+ span.run46 {
334
+ background-color: rgb(179, 255, 178);
335
+ display: block;
336
+ }
337
+ span.run47 {
338
+ background-color: rgb(182, 255, 178);
339
+ display: block;
340
+ }
341
+ span.run48 {
342
+ background-color: rgb(184, 255, 178);
343
+ display: block;
344
+ }
345
+ span.run49 {
346
+ background-color: rgb(187, 255, 178);
347
+ display: block;
348
+ }
349
+ span.run50 {
350
+ background-color: rgb(191, 255, 178);
351
+ display: block;
352
+ }
353
+ span.run51 {
354
+ background-color: rgb(193, 255, 178);
355
+ display: block;
356
+ }
357
+ span.run52 {
358
+ background-color: rgb(196, 255, 178);
359
+ display: block;
360
+ }
361
+ span.run53 {
362
+ background-color: rgb(198, 255, 178);
363
+ display: block;
364
+ }
365
+ span.run54 {
366
+ background-color: rgb(201, 255, 178);
367
+ display: block;
368
+ }
369
+ span.run55 {
370
+ background-color: rgb(205, 255, 178);
371
+ display: block;
372
+ }
373
+ span.run56 {
374
+ background-color: rgb(207, 255, 178);
375
+ display: block;
376
+ }
377
+ span.run57 {
378
+ background-color: rgb(210, 255, 178);
379
+ display: block;
380
+ }
381
+ span.run58 {
382
+ background-color: rgb(212, 255, 178);
383
+ display: block;
384
+ }
385
+ span.run59 {
386
+ background-color: rgb(215, 255, 178);
387
+ display: block;
388
+ }
389
+ span.run60 {
390
+ background-color: rgb(219, 255, 178);
391
+ display: block;
392
+ }
393
+ span.run61 {
394
+ background-color: rgb(221, 255, 178);
395
+ display: block;
396
+ }
397
+ span.run62 {
398
+ background-color: rgb(224, 255, 178);
399
+ display: block;
400
+ }
401
+ span.run63 {
402
+ background-color: rgb(226, 255, 178);
403
+ display: block;
404
+ }
405
+ span.run64 {
406
+ background-color: rgb(229, 255, 178);
407
+ display: block;
408
+ }
409
+ span.run65 {
410
+ background-color: rgb(233, 255, 178);
411
+ display: block;
412
+ }
413
+ span.run66 {
414
+ background-color: rgb(235, 255, 178);
415
+ display: block;
416
+ }
417
+ span.run67 {
418
+ background-color: rgb(238, 255, 178);
419
+ display: block;
420
+ }
421
+ span.run68 {
422
+ background-color: rgb(240, 255, 178);
423
+ display: block;
424
+ }
425
+ span.run69 {
426
+ background-color: rgb(243, 255, 178);
427
+ display: block;
428
+ }
429
+ span.run70 {
430
+ background-color: rgb(247, 255, 178);
431
+ display: block;
432
+ }
433
+ span.run71 {
434
+ background-color: rgb(249, 255, 178);
435
+ display: block;
436
+ }
437
+ span.run72 {
438
+ background-color: rgb(252, 255, 178);
439
+ display: block;
440
+ }
441
+ span.run73 {
442
+ background-color: rgb(255, 255, 178);
443
+ display: block;
444
+ }
445
+ span.run74 {
446
+ background-color: rgb(255, 252, 178);
447
+ display: block;
448
+ }
449
+ span.run75 {
450
+ background-color: rgb(255, 248, 178);
451
+ display: block;
452
+ }
453
+ span.run76 {
454
+ background-color: rgb(255, 246, 178);
455
+ display: block;
456
+ }
457
+ span.run77 {
458
+ background-color: rgb(255, 243, 178);
459
+ display: block;
460
+ }
461
+ span.run78 {
462
+ background-color: rgb(255, 240, 178);
463
+ display: block;
464
+ }
465
+ span.run79 {
466
+ background-color: rgb(255, 238, 178);
467
+ display: block;
468
+ }
469
+ span.run80 {
470
+ background-color: rgb(255, 234, 178);
471
+ display: block;
472
+ }
473
+ span.run81 {
474
+ background-color: rgb(255, 232, 178);
475
+ display: block;
476
+ }
477
+ span.run82 {
478
+ background-color: rgb(255, 229, 178);
479
+ display: block;
480
+ }
481
+ span.run83 {
482
+ background-color: rgb(255, 226, 178);
483
+ display: block;
484
+ }
485
+ span.run84 {
486
+ background-color: rgb(255, 224, 178);
487
+ display: block;
488
+ }
489
+ span.run85 {
490
+ background-color: rgb(255, 220, 178);
491
+ display: block;
492
+ }
493
+ span.run86 {
494
+ background-color: rgb(255, 218, 178);
495
+ display: block;
496
+ }
497
+ span.run87 {
498
+ background-color: rgb(255, 215, 178);
499
+ display: block;
500
+ }
501
+ span.run88 {
502
+ background-color: rgb(255, 212, 178);
503
+ display: block;
504
+ }
505
+ span.run89 {
506
+ background-color: rgb(255, 210, 178);
507
+ display: block;
508
+ }
509
+ span.run90 {
510
+ background-color: rgb(255, 206, 178);
511
+ display: block;
512
+ }
513
+ span.run91 {
514
+ background-color: rgb(255, 204, 178);
515
+ display: block;
516
+ }
517
+ span.run92 {
518
+ background-color: rgb(255, 201, 178);
519
+ display: block;
520
+ }
521
+ span.run93 {
522
+ background-color: rgb(255, 198, 178);
523
+ display: block;
524
+ }
525
+ span.run94 {
526
+ background-color: rgb(255, 196, 178);
527
+ display: block;
528
+ }
529
+ span.run95 {
530
+ background-color: rgb(255, 192, 178);
531
+ display: block;
532
+ }
533
+ span.run96 {
534
+ background-color: rgb(255, 189, 178);
535
+ display: block;
536
+ }
537
+ span.run97 {
538
+ background-color: rgb(255, 187, 178);
539
+ display: block;
540
+ }
541
+ span.run98 {
542
+ background-color: rgb(255, 184, 178);
543
+ display: block;
544
+ }
545
+ span.run99 {
546
+ background-color: rgb(255, 182, 178);
547
+ display: block;
548
+ }
549
+ span.run100 {
550
+ background-color: rgb(255, 178, 178);
551
+ display: block;
552
+ }
553
+ </style>
554
+ </head>
555
+ <body><h3>C0 code coverage information</h3>
556
+ <p>Generated on Thu Aug 21 17:23:12 +0900 2008 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
557
+ </p>
558
+ <hr/>
559
+ <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
560
+ </span><span class='marked1'>and this: this line is also marked as covered.
561
+ </span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this,
562
+ </span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).
563
+ </span><span class='uncovered0'>Finally, here&apos;s a line marked as not executed.
564
+ </span></pre>
565
+ <table class='report'><thead><tr><td class='heading'>Name</td>
566
+ <td class='heading'>Total lines</td>
567
+ <td class='heading'>Lines of code</td>
568
+ <td class='heading'>Total coverage</td>
569
+ <td class='heading'>Code coverage</td>
570
+ </tr>
571
+ </thead>
572
+ <tbody><tr class='light'><td><a href='lib-classx-attribute_rb.html'>lib/classx/attribute.rb</a>
573
+ </td>
574
+ <td class='lines_total'><tt>178</tt>
575
+ </td>
576
+ <td class='lines_code'><tt>142</tt>
577
+ </td>
578
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>52.8%</tt>
579
+ &nbsp;</td>
580
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='53'/>
581
+ <td class='uncovered' width='47'/>
582
+ </tr>
583
+ </table>
584
+ </td>
585
+ </tr>
586
+ </table>
587
+ </td>
588
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>45.1%</tt>
589
+ &nbsp;</td>
590
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='45'/>
591
+ <td class='uncovered' width='55'/>
592
+ </tr>
593
+ </table>
594
+ </td>
595
+ </tr>
596
+ </table>
597
+ </td>
598
+ </tr>
599
+ </tbody>
600
+ </table>
601
+ <pre><span class="marked0"><a name="line1"></a> 1 class ClassX
602
+ </span><span class="marked1"><a name="line2"></a> 2 class AttributeFactory
603
+ </span><span class="marked0"><a name="line3"></a> 3 def self.create args
604
+ </span><span class="marked1"><a name="line4"></a> 4 klass = Class.new
605
+ </span><span class="marked0"><a name="line5"></a> 5 klass.class_eval do
606
+ </span><span class="inferred1"><a name="line6"></a> 6
607
+ </span><span class="inferred0"><a name="line7"></a> 7 # XXX: Hack for defining class method for klass
608
+ </span><span class="marked1"><a name="line8"></a> 8 tmp_mod = Module.new
609
+ </span><span class="marked0"><a name="line9"></a> 9 tmp_mod.module_eval do
610
+ </span><span class="marked1"><a name="line10"></a> 10 define_method :config do
611
+ </span><span class="marked0"><a name="line11"></a> 11 args
612
+ </span><span class="inferred1"><a name="line12"></a> 12 end
613
+ </span><span class="inferred0"><a name="line13"></a> 13
614
+ </span><span class="marked1"><a name="line14"></a> 14 define_method :value_class do
615
+ </span><span class="uncovered0"><a name="line15"></a> 15 args[:isa] || args[:kind_of]
616
+ </span><span class="uncovered1"><a name="line16"></a> 16 end
617
+ </span><span class="inferred0"><a name="line17"></a> 17
618
+ </span><span class="inferred1"><a name="line18"></a> 18 # description for attribute
619
+ </span><span class="marked0"><a name="line19"></a> 19 define_method :desc do
620
+ </span><span class="uncovered1"><a name="line20"></a> 20 args[:desc]
621
+ </span><span class="uncovered0"><a name="line21"></a> 21 end
622
+ </span><span class="inferred1"><a name="line22"></a> 22
623
+ </span><span class="inferred0"><a name="line23"></a> 23 # you specify type changing rule with :coerce option.
624
+ </span><span class="inferred1"><a name="line24"></a> 24 #
625
+ </span><span class="marked0"><a name="line25"></a> 25 define_method :coerce do |val|
626
+ </span><span class="marked1"><a name="line26"></a> 26 if args[:coerce]
627
+ </span><span class="uncovered0"><a name="line27"></a> 27 case args[:coerce]
628
+ </span><span class="uncovered1"><a name="line28"></a> 28 when Hash
629
+ </span><span class="uncovered0"><a name="line29"></a> 29 result = val
630
+ </span><span class="uncovered1"><a name="line30"></a> 30 args[:coerce].each do |cond, rule|
631
+ </span><span class="uncovered0"><a name="line31"></a> 31 case cond
632
+ </span><span class="uncovered1"><a name="line32"></a> 32 when Proc
633
+ </span><span class="uncovered0"><a name="line33"></a> 33 if cond.call(val)
634
+ </span><span class="uncovered1"><a name="line34"></a> 34 result = rule.call(val)
635
+ </span><span class="uncovered0"><a name="line35"></a> 35 break
636
+ </span><span class="uncovered1"><a name="line36"></a> 36 end
637
+ </span><span class="uncovered0"><a name="line37"></a> 37 when Symbol
638
+ </span><span class="uncovered1"><a name="line38"></a> 38 if val.respond_to? cond
639
+ </span><span class="uncovered0"><a name="line39"></a> 39 result = rule.call(val)
640
+ </span><span class="uncovered1"><a name="line40"></a> 40 break
641
+ </span><span class="uncovered0"><a name="line41"></a> 41 end
642
+ </span><span class="uncovered1"><a name="line42"></a> 42 when Module
643
+ </span><span class="uncovered0"><a name="line43"></a> 43 if val.kind_of? cond
644
+ </span><span class="uncovered1"><a name="line44"></a> 44 result = rule.call(val)
645
+ </span><span class="uncovered0"><a name="line45"></a> 45 break
646
+ </span><span class="uncovered1"><a name="line46"></a> 46 end
647
+ </span><span class="uncovered0"><a name="line47"></a> 47 end
648
+ </span><span class="uncovered1"><a name="line48"></a> 48 end
649
+ </span><span class="uncovered0"><a name="line49"></a> 49
650
+ </span><span class="uncovered1"><a name="line50"></a> 50 return result
651
+ </span><span class="uncovered0"><a name="line51"></a> 51 when Array
652
+ </span><span class="uncovered1"><a name="line52"></a> 52 result = val
653
+ </span><span class="uncovered0"><a name="line53"></a> 53 args[:coerce].each do |item|
654
+ </span><span class="uncovered1"><a name="line54"></a> 54 raise unless item.kind_of? Hash
655
+ </span><span class="uncovered0"><a name="line55"></a> 55
656
+ </span><span class="uncovered1"><a name="line56"></a> 56 case item
657
+ </span><span class="uncovered0"><a name="line57"></a> 57 when Hash
658
+ </span><span class="uncovered1"><a name="line58"></a> 58 item.each do |cond, rule|
659
+ </span><span class="uncovered0"><a name="line59"></a> 59
660
+ </span><span class="uncovered1"><a name="line60"></a> 60 case cond
661
+ </span><span class="uncovered0"><a name="line61"></a> 61 when Proc
662
+ </span><span class="uncovered1"><a name="line62"></a> 62 if cond.call(val)
663
+ </span><span class="uncovered0"><a name="line63"></a> 63 result = rule.call(val)
664
+ </span><span class="uncovered1"><a name="line64"></a> 64 break
665
+ </span><span class="uncovered0"><a name="line65"></a> 65 end
666
+ </span><span class="uncovered1"><a name="line66"></a> 66 end
667
+ </span><span class="uncovered0"><a name="line67"></a> 67
668
+ </span><span class="uncovered1"><a name="line68"></a> 68 break if result
669
+ </span><span class="uncovered0"><a name="line69"></a> 69 end
670
+ </span><span class="uncovered1"><a name="line70"></a> 70 end
671
+ </span><span class="uncovered0"><a name="line71"></a> 71
672
+ </span><span class="uncovered1"><a name="line72"></a> 72 break if result
673
+ </span><span class="uncovered0"><a name="line73"></a> 73 end
674
+ </span><span class="uncovered1"><a name="line74"></a> 74
675
+ </span><span class="uncovered0"><a name="line75"></a> 75 return result
676
+ </span><span class="uncovered1"><a name="line76"></a> 76 end
677
+ </span><span class="inferred0"><a name="line77"></a> 77 else
678
+ </span><span class="marked1"><a name="line78"></a> 78 return val
679
+ </span><span class="inferred0"><a name="line79"></a> 79 end
680
+ </span><span class="marked1"><a name="line80"></a> 80 end
681
+ </span><span class="inferred0"><a name="line81"></a> 81
682
+ </span><span class="inferred1"><a name="line82"></a> 82 # you can specify :validate option for checking when value is setted.
683
+ </span><span class="inferred0"><a name="line83"></a> 83 # you can use :respond_to as shotcut for specifying { :validate =&gt; proc {|val| respond_to?(val, true) } }
684
+ </span><span class="inferred1"><a name="line84"></a> 84 # you can use :isa or :kind_of as shotcut for specifying { :validate =&gt; proc {|val| kind_of?(val) } }
685
+ </span><span class="marked0"><a name="line85"></a> 85 define_method :validate? do |val|
686
+ </span><span class="marked1"><a name="line86"></a> 86 if args[:validate]
687
+ </span><span class="uncovered0"><a name="line87"></a> 87 case args[:validate]
688
+ </span><span class="uncovered1"><a name="line88"></a> 88 when Proc
689
+ </span><span class="uncovered0"><a name="line89"></a> 89 return args[:validate].call(val)
690
+ </span><span class="uncovered1"><a name="line90"></a> 90 when Regexp
691
+ </span><span class="uncovered0"><a name="line91"></a> 91 return args[:validate] =~ val
692
+ </span><span class="uncovered1"><a name="line92"></a> 92 else
693
+ </span><span class="uncovered0"><a name="line93"></a> 93 return args[:validate] == val
694
+ </span><span class="uncovered1"><a name="line94"></a> 94 end
695
+ </span><span class="marked0"><a name="line95"></a> 95 elsif mod = ( args[:isa] || args[:kind_of] )
696
+ </span><span class="marked1"><a name="line96"></a> 96 return val.kind_of?(mod)
697
+ </span><span class="marked0"><a name="line97"></a> 97 elsif args[:respond_to]
698
+ </span><span class="uncovered1"><a name="line98"></a> 98 return val.respond_to?(args[:respond_to], true)
699
+ </span><span class="inferred0"><a name="line99"></a> 99 else
700
+ </span><span class="inferred1"><a name="line100"></a>100 # nothing checked.
701
+ </span><span class="marked0"><a name="line101"></a>101 true
702
+ </span><span class="inferred1"><a name="line102"></a>102 end
703
+ </span><span class="inferred0"><a name="line103"></a>103 end
704
+ </span><span class="inferred1"><a name="line104"></a>104
705
+ </span><span class="inferred0"><a name="line105"></a>105 # default paramater for attribute.
706
+ </span><span class="inferred1"><a name="line106"></a>106 # if default is Proc, run Proc every time in instanciate.
707
+ </span><span class="marked0"><a name="line107"></a>107 define_method :default do |parent|
708
+ </span><span class="marked1"><a name="line108"></a>108 case args[:default]
709
+ </span><span class="marked0"><a name="line109"></a>109 when Proc
710
+ </span><span class="marked1"><a name="line110"></a>110 args[:default].call(parent)
711
+ </span><span class="inferred0"><a name="line111"></a>111 else
712
+ </span><span class="marked1"><a name="line112"></a>112 args[:default]
713
+ </span><span class="inferred0"><a name="line113"></a>113 end
714
+ </span><span class="inferred1"><a name="line114"></a>114 end
715
+ </span><span class="inferred0"><a name="line115"></a>115
716
+ </span><span class="inferred1"><a name="line116"></a>116 # when this option specify true, not raise error in #initialize without value.
717
+ </span><span class="marked0"><a name="line117"></a>117 define_method :optional? do
718
+ </span><span class="marked1"><a name="line118"></a>118 return args[:optional]
719
+ </span><span class="inferred0"><a name="line119"></a>119 end
720
+ </span><span class="inferred1"><a name="line120"></a>120
721
+ </span><span class="inferred0"><a name="line121"></a>121 # when it lazy option specified, it will not be initialized when #initialize.
722
+ </span><span class="marked1"><a name="line122"></a>122 define_method :lazy? do
723
+ </span><span class="marked0"><a name="line123"></a>123 return args[:lazy]
724
+ </span><span class="inferred1"><a name="line124"></a>124 end
725
+ </span><span class="inferred0"><a name="line125"></a>125
726
+ </span><span class="inferred1"><a name="line126"></a>126 end
727
+ </span><span class="marked0"><a name="line127"></a>127 __send__ :extend, tmp_mod
728
+ </span><span class="inferred1"><a name="line128"></a>128
729
+ </span><span class="marked0"><a name="line129"></a>129 raise ClassX::RequiredAttrShouldNotHaveDefault if args[:optional] == false &amp;&amp; !args[:default].nil?
730
+ </span><span class="marked1"><a name="line130"></a>130 raise ClassX::OptionalAttrShouldBeWritable if args[:optional] &amp;&amp; args[:writable] == false
731
+ </span><span class="inferred0"><a name="line131"></a>131
732
+ </span><span class="marked1"><a name="line132"></a>132 define_method :initialize do |val|
733
+ </span><span class="marked0"><a name="line133"></a>133 @parent = val
734
+ </span><span class="marked1"><a name="line134"></a>134 @data = nil
735
+ </span><span class="inferred0"><a name="line135"></a>135 end
736
+ </span><span class="inferred1"><a name="line136"></a>136
737
+ </span><span class="marked0"><a name="line137"></a>137 define_method :get do
738
+ </span><span class="marked1"><a name="line138"></a>138 @data ||= self.class.default(@parent)
739
+ </span><span class="inferred0"><a name="line139"></a>139 end
740
+ </span><span class="inferred1"><a name="line140"></a>140
741
+ </span><span class="marked0"><a name="line141"></a>141 define_method :set do |val|
742
+ </span><span class="marked1"><a name="line142"></a>142 val = self.class.coerce(val)
743
+ </span><span class="marked0"><a name="line143"></a>143 raise ClassX::InvalidAttrArgument unless self.class.validate? val
744
+ </span><span class="marked1"><a name="line144"></a>144 @data = val
745
+ </span><span class="inferred0"><a name="line145"></a>145 end
746
+ </span><span class="inferred1"><a name="line146"></a>146
747
+ </span><span class="inferred0"><a name="line147"></a>147 # for extending attribute point.
748
+ </span><span class="marked1"><a name="line148"></a>148 if args[:include]
749
+ </span><span class="uncovered0"><a name="line149"></a>149 case args[:include]
750
+ </span><span class="uncovered1"><a name="line150"></a>150 when Array
751
+ </span><span class="uncovered0"><a name="line151"></a>151 args[:include].each do |mod|
752
+ </span><span class="uncovered1"><a name="line152"></a>152 self.__send__ :include, mod
753
+ </span><span class="uncovered0"><a name="line153"></a>153 end
754
+ </span><span class="uncovered1"><a name="line154"></a>154 else
755
+ </span><span class="uncovered0"><a name="line155"></a>155 self.__send__ :include, args[:include]
756
+ </span><span class="uncovered1"><a name="line156"></a>156 end
757
+ </span><span class="uncovered0"><a name="line157"></a>157 end
758
+ </span><span class="inferred1"><a name="line158"></a>158
759
+ </span><span class="marked0"><a name="line159"></a>159 if args[:extend]
760
+ </span><span class="uncovered1"><a name="line160"></a>160 case args[:extend]
761
+ </span><span class="uncovered0"><a name="line161"></a>161 when Array
762
+ </span><span class="uncovered1"><a name="line162"></a>162 args[:extend].each do |mod|
763
+ </span><span class="uncovered0"><a name="line163"></a>163 self.__send__ :extend, mod
764
+ </span><span class="uncovered1"><a name="line164"></a>164 end
765
+ </span><span class="uncovered0"><a name="line165"></a>165 else
766
+ </span><span class="uncovered1"><a name="line166"></a>166 self.__send__ :extend, args[:extend]
767
+ </span><span class="uncovered0"><a name="line167"></a>167 end
768
+ </span><span class="uncovered1"><a name="line168"></a>168 end
769
+ </span><span class="inferred0"><a name="line169"></a>169
770
+ </span><span class="marked1"><a name="line170"></a>170 define_method :inspect do
771
+ </span><span class="uncovered0"><a name="line171"></a>171 &quot;&lt;#ClassX::Attribute #{self.class.config.inspect}:#{object_id} #{ @data.nil? ? '' : '@data=' + @data.inspect } &gt;&quot;
772
+ </span><span class="uncovered1"><a name="line172"></a>172 end
773
+ </span><span class="uncovered0"><a name="line173"></a>173 end
774
+ </span><span class="inferred1"><a name="line174"></a>174
775
+ </span><span class="marked0"><a name="line175"></a>175 klass
776
+ </span><span class="inferred1"><a name="line176"></a>176 end
777
+ </span><span class="inferred0"><a name="line177"></a>177 end
778
+ </span><span class="inferred1"><a name="line178"></a>178 end
779
+ </span></pre><hr/>
780
+ <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a>
781
+ version 0.8.1.2.</p>
782
+ <p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/>
783
+ </a>
784
+ <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/>
785
+ </a>
786
+ </p>
787
+ </body>
788
+ </html>