blib/lib/Aion/Type/Lim.pm

filter: Statementstmt 100% 26 / 26 Branchbran 85.7% 12 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 96.0% 49 / 51 CC 8 SCAR 7.3
CC
8
Cov
95%
_up
3.0
dec
2.0
inc
2.0
CRAP 2.1
« blib/lib/Aion/Meta/FeatureConstruct.pm ↑ Summary blib/lib/Aion/Meta/RequiresAnyFunction.pm »
1 package Aion::Type::Lim;
2 # Граница для Range
3  
4 9 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 use overload
7 9 ▶ "fallback" => 1,
Subroutine BEGIN: called CC=1 SCAR=0.0
8 455 ▶ "<=>" => sub { my ($self, $other) = _up(@_); $self->{lim} == $other->{lim}? $self->{shifting} <=> $other->{shifting}: $self->{lim} <=> $other->{lim} },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$self->{'lim'} == $other->{'lim'} ? : 22 433 455
9 57 ▶ '""' => sub { my ($self) = @_; $self->{shifting}? "Opened[$self->{lim}]": "Closed[$self->{lim}]" },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$self->{'shifting'} ? : 54 3 57
10 9 ;
11  
12 # Конструктор
13 350 ▶sub from {
Subroutine from: called CC=2 SCAR=6.9
Pod documented
14 350 my ($cls, $lim) = @_;
15 350 ▶ bless { ref $lim eq $cls? %$lim: (lim => $lim) }, $cls;
Branch: 1 branch
BranchTrueFalseTotal
ref $lim eq $cls ? : 2 348 350
16 }
17  
18 # Преобразователь операторных аргументов
19 455 ▶sub _up {
Subroutine _up: called CC=3 SCAR=11.0
20 455 my ($self, $other, $right) = @_;
21 455 ▶ unless(UNIVERSAL::isa($other, __PACKAGE__)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (UNIVERSAL::isa($other, __PACKAGE__)) 322 133 455
22 322 $other = __PACKAGE__->from($other);
23 322 ▶ ($other, $self) = ($self, $other) if $right;
Branch: 1 branch
BranchTrueFalseTotal
if $right 105 217 322
24 }
25 455 return $self, $other;
26 }
27  
28 # Умесньшает сдвиг
29 14 ▶sub dec {
Subroutine dec: called CC=2 SCAR=7.0
Pod documented
30 14 my ($self) = @_;
31 14 ▶ $self->{lim} == '-Inf'? '-Inf': do { $self->{shifting}--; $self }
Branch: 1 branch
BranchTrueFalseTotal
$self->{'lim'} == '-Inf' ? : 0 14 14
32 }
33  
34 # Увеличивает сдвиг
35 13 ▶sub inc {
Subroutine inc: called CC=2 SCAR=7.0
Pod documented
36 13 my ($self) = @_;
37 13 ▶ $self->{lim} == 'Inf'? 'Inf': do { $self->{shifting}++; $self }
Branch: 1 branch
BranchTrueFalseTotal
$self->{'lim'} == 'Inf' ? : 0 13 13
38 }
39  
40 9 1;
41  
42 __END__
« blib/lib/Aion/Meta/FeatureConstruct.pm ↑ Summary blib/lib/Aion/Meta/RequiresAnyFunction.pm »