File Coverage

blib/lib/CSS/Object/Rule/At.pm
Criterion Covered Total %
statement 20 21 95.2
branch 1 2 50.0
condition n/a
subroutine 8 9 88.8
pod 3 4 75.0
total 32 36 88.8


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## CSS Object Oriented - ~/lib/CSS/Object/Rule/At.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::Rule::At;
14             BEGIN
15             {
16 6     6   39 use strict;
  6         15  
  6         255  
17 6     6   30 use warnings;
  6         10  
  6         351  
18 6     6   31 use parent qw( CSS::Object::Rule );
  6         10  
  6         61  
19             use overload (
20 6         53 '""' => 'as_string',
21             fallback => 1,
22 6     6   550 );
  6         13  
23 6     6   1769 our $VERSION = 'v0.2.0';
24             };
25              
26             sub init
27             {
28 1     1 1 2 my $self = shift( @_ );
29 1         97 $self->{_init_strict_use_sub} = 1;
30 1         9 $self->SUPER::init( @_ );
31 1 50       3 return( $self->error( "No css object was shared with us." ) ) if( !$self->css );
32 1         23 return( $self );
33             }
34              
35 9     9 0 283 sub css { return( shift->_set_get_object( 'css', 'CSS::Object', @_ ) ); }
36              
37 20     20 1 1733 sub name { return( shift->_set_get_scalar_as_object( 'name', @_ ) ); }
38              
39             # e.g. keyframe
40 0     0 1   sub value { return( shift->_set_get_scalar_as_object( 'value', @_ ) ); }
41              
42              
43             1;
44             # NOTE: POD
45             __END__
46              
47             =encoding utf-8
48              
49             =head1 NAME
50              
51             CSS::Object::Rule::At - CSS Object Oriented At-Rule
52              
53             =head1 SYNOPSIS
54              
55             use CSS::Object::Rule::At;
56             my $rule = CSS::Object::Rule::At->new( debug => 3, format => $format_object ) ||
57             die( CSS::Object::Rule::At->error );
58              
59             =head1 VERSION
60              
61             v0.2.0
62              
63             =head1 DESCRIPTION
64              
65             L<CSS::Object::Rule::At> is a base class for at-rule type of objects, such as C<@counter-style>, C<@document>, C<@font-face>, C<@font-feature-values>, C<@import>, C<@keyframes>, C<media>, C<@namespace>, C<@page>, C<supports>, C<@viewport> and some other experimental ones such as C<@annotation>, C<@character-variant>, C<@ornaments>, C<@stylistic>, C<@styleset>, C<@swash>,
66              
67             See here for more information: L<https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule>
68              
69             =head1 CONSTRUCTOR
70              
71             =head2 new
72              
73             To instantiate a new L<CSS::Object::Rule::At> object, pass an hash reference of following parameters:
74              
75             =over 4
76              
77             =item I<debug>
78              
79             This is an integer. The bigger it is and the more verbose is the output.
80              
81             =item I<format>
82              
83             This is a L<CSS::Object::Format> object or one of its child modules.
84              
85             =back
86              
87             =head1 METHODS
88              
89             =head2 name
90              
91             Sets or gets the name of this at-rule. It returns a L<Module::Generic::Scalar>
92              
93             =head2 value
94              
95             Sets or gets this at-rule's value. It returns a L<Module::Generic::Scalar>
96              
97             head1 AUTHOR
98              
99             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
100              
101             =head1 SEE ALSO
102              
103             L<CSS::Object>
104              
105             =head1 COPYRIGHT & LICENSE
106              
107             Copyright (c) 2020 DEGUEST Pte. Ltd.
108              
109             You can use, copy, modify and redistribute this package and associated
110             files under the same terms as Perl itself.
111              
112             =cut