line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rubyish::NilClass; |
2
|
16
|
|
|
16
|
|
99
|
use strict; |
|
16
|
|
|
|
|
32
|
|
|
16
|
|
|
|
|
641
|
|
3
|
16
|
|
|
16
|
|
86
|
use warnings; |
|
16
|
|
|
|
|
79
|
|
|
16
|
|
|
|
|
822
|
|
4
|
|
|
|
|
|
|
|
5
|
16
|
|
|
16
|
|
91
|
use base qw(Rubyish::Object); |
|
16
|
|
|
|
|
32
|
|
|
16
|
|
|
|
|
366
|
|
6
|
|
|
|
|
|
|
use Rubyish::Kernel; |
7
|
|
|
|
|
|
|
use Rubyish::Syntax::def; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload |
10
|
|
|
|
|
|
|
'bool' => sub { }, |
11
|
|
|
|
|
|
|
# '+0' => sub { 0 }, |
12
|
|
|
|
|
|
|
# '""' => sub { '' }; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
def inspect { "nil" }; |
15
|
|
|
|
|
|
|
def nil { 1 }; |
16
|
|
|
|
|
|
|
def to_a { Array }; |
17
|
|
|
|
|
|
|
def to_f { 0.0 }; |
18
|
|
|
|
|
|
|
def to_i { 0 }; |
19
|
|
|
|
|
|
|
def to_s { String("") }; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# cheat |
23
|
|
|
|
|
|
|
def object_id { 4 }; |
24
|
|
|
|
|
|
|
{ no strict; *__id__ = *object_id; } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
my $obj = bless {}, __PACKAGE__; |
28
|
|
|
|
|
|
|
sub new { |
29
|
|
|
|
|
|
|
return $obj if defined $obj; |
30
|
|
|
|
|
|
|
$obj = bless {}, __PACKAGE__; |
31
|
|
|
|
|
|
|
return $obj; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Rubyish::NilClass - The NilClass implementation |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
nil->to_i |
45
|
|
|
|
|
|
|
nil->to_f |
46
|
|
|
|
|
|
|
nil->to_a |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This class defnes those instance methods availble for the singleton object C |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over 4 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item to_i |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Always returns 0 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item to_f |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Always returns 0.0 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item to_s |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Always returns an empty string "" |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item to_a |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Always returns [] |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Kang-min Liu C<< >>, shelling C |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 LICENCE AND COPYRIGHT |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Copyright (c) 2008,2009, Kang-min Liu C<< >>. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This is free software, licensed under: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The MIT (X11) License |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
87
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
88
|
|
|
|
|
|
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
89
|
|
|
|
|
|
|
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
90
|
|
|
|
|
|
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
91
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
92
|
|
|
|
|
|
|
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
93
|
|
|
|
|
|
|
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
94
|
|
|
|
|
|
|
NECESSARY SERVICING, REPAIR, OR CORRECTION. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
97
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
98
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE |
99
|
|
|
|
|
|
|
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
100
|
|
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
101
|
|
|
|
|
|
|
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
102
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
103
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
104
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
105
|
|
|
|
|
|
|
SUCH DAMAGES. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|