Object/Selector.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 87.5% 7 / 8 Podpod 100% 4 / 4 totaltotal 88.1% 37 / 42 CC 3 SCAR 5.4
CC
3
Cov
90%
add_to
3.1
as_string
2.0
BEGIN
1.0
CRAP 1.7
« Object/Parser.pm ↑ Summary Object/Comment.pm »
1 ##----------------------------------------------------------------------------
2 ## CSS Object Oriented - ~/lib/CSS/Object/Selector.pm
3 ## Version v0.2.0
4 ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2020/06/21
7 ## Modified 2024/09/05
8 ## All rights reserved
9 ##
10 ## This program is free software; you can redistribute it and/or modify it
11 ## under the same terms as Perl itself.
12 ##----------------------------------------------------------------------------
13 package CSS::Object::Selector;
14 BEGIN
15 6 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
16 6 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 6 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 6 ▶ use parent qw( CSS::Object::Element );
Subroutine BEGIN: called CC=1 SCAR=0.0
19 6 our $VERSION = 'v0.2.0';
20 };
21  
22 sub init
23 48 ▶{
Subroutine init: called CC=1 SCAR=0.0
Pod documented
24 48 my $self = shift( @_ );
25 48 $self->{name} = '';
26 48 $self->{format} = '';
27 48 $self->{_init_strict_use_sub} = 1;
28 48 $self->SUPER::init( @_ );
29 48 return( $self );
30 }
31  
32 ## Inherited
33 ## sub format
34  
35 sub add_to
36 14 ▶{
Subroutine add_to: called CC=3 SCAR=11.2
Pod documented
37 14 my $self = shift( @_ );
38 14 ▶ my $rule = shift( @_ ) || return( $self->error( "No rule object was provided to add our selctor to it." ) );
Condition50%1/2
shift @_ || (return $self->error('No rule object was provided to add our selctor to it.'))
l!l
140
MC/DC0%0/1
shift @_ || (return $self->error('No rule object was provided to add our selctor to it.'))
shift @_
Truth table50%1/2
A
A= shift @_
Aresult
11
00
39 14 ▶ return( $self->error( "Rule object provided (", overload::StrVal( $rule ), ") is not actually a CSS::Object::Rule object." ) ) if( !$self->_is_a( $rule, 'CSS::Object::Rule' ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_is_a($rule, "CSS::Object::Rule") 0 14 14
40 14 $self->format->indent( $rule->format->indent );
41 14 $rule->add_selector( $self );
42 14 return( $self );
43 }
44  
45 0 ▶sub as_string { return( shift->name ); }
Subroutine as_string: not called CC=1 SCAR=6.9
Pod documented
46  
47 267 ▶sub name { return( shift->_set_get_scalar_as_object( 'name', @_ ) ); }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
48  
49 6 1;
50 # NOTE: POD
51 __END__
« Object/Parser.pm ↑ Summary Object/Comment.pm »