NG/Hashtable.pm

filter: Statementstmt 25.8% 8 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 18.1% 2 / 11 Podpod n/a totaltotal 23.8% 10 / 42 CC 1 SCAR 6.0
CC
1
Cov
26%
__ANON__
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.8
« NG/Dir.pm ↑ Summary NG/SHashtable.pm »
1 1 ▶use NG::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use NG::Array;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 NG::Class::def 'NG::Hashtable' => [] => {
4  
5 0 ▶ put => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
6 0 my ( $self, $key, $val ) = @_;
7 0 $self->{$key} = $val;
8 0 return $self;
9 },
10
11 0 ▶ get => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
12 0 my ( $self, $key ) = @_;
13 0 return $self->{$key};
14 },
15
16 0 ▶ keys => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
17 0 my ($self) = @_;
18 0 return new NG::Array( keys %$self );
19 },
20
21 0 ▶ values => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 my ($self) = @_;
23 0 return new NG::Array( values %$self );
24 },
25
26 0 ▶ remove => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 0 my ( $self, $key ) = @_;
28 0 delete $self->{$key};
29 0 return $self;
30 },
31
32 0 ▶ each => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 0 my ( $self, $sub ) = @_;
34 $self->keys->each(
35 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
36 0 my ($key) = @_;
37 0 $sub->( $key, $self->get($key) );
38 }
39 0 );
40 0 return $self;
41 },
42
43 0 ▶ flip => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
44 0 my ($self) = @_;
45 0 my $tmp = NG::Hashtable->new;
46 $self->keys->each(
47 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
48 0 my ($key) = @_;
49 0 $tmp->put( $self->get($key), $key );
50 }
51 0 );
52 0 return $tmp;
53 },
54  
55 1 };
56  
57 1 1;
« NG/Dir.pm ↑ Summary NG/SHashtable.pm »