lib/Reaction/UI/ViewPort/Field/String/Fragment.pm

filter: Statementstmt 52.6% 10 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod n/a totaltotal 46.1% 12 / 26 CC 2 SCAR 11.0
CC
2
Cov
48%
__ANON__
6.0
__ANON__
2.0
_build_layout
2.0
CRAP 3.0
« lib/Reaction/Role.pm ↑ Summary lib/Reaction/UI/Widget/Collection/Grid.pm »
1 package Reaction::UI::ViewPort::Field::String::Fragment;
2  
3 4 ▶use Reaction::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use MooseX::Types::Moose qw/Int/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 extends 'Reaction::UI::ViewPort::Field::String';
6  
7 has max_length => (
8 is => 'rw',
9 isa => Int,
10 required => 1,
11 0 ▶ default => sub { 80 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
12 4 );
13  
14 0 ▶sub _build_layout { 'field/string' };
Subroutine _build_layout: not called CC=1 SCAR=6.9
15  
16 0 ▶around _build_value_string => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
17 0 my $super = shift;
18 0 my $self = $_[0];
19 0 my $string = $super->(@_);
20 0 my $max_len = $self->max_length;
21 0 ▶ if(length($string) > $max_len){
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > $max_len) 0 0 0
22 0 $string = join('', substr( $string, 0, $max_len - 3 ), '...');
23 }
24 0 return $string;
25 4 };
26  
27 4 1;
28  
29 __END__;
« lib/Reaction/Role.pm ↑ Summary lib/Reaction/UI/Widget/Collection/Grid.pm »