jQuery/Plugin/funcliteral.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 33 / 33 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« jQuery/Role/Plugin.pm ↑ Summary jQuery/Subtypes.pm »
1 package JavaScript::Framework::jQuery::Plugin::funcliteral;
2  
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use JavaScript::Framework::jQuery::Subtypes qw( libraryAssets pluginAssets );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use MooseX::Types::Moose qw( Str ArrayRef );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION = '0.05';
11  
12 2 has 'name' => (
13 is => 'ro',
14 isa => Str,
15 required => 1,
16 default => 'funcliteral',
17 );
18  
19 2 has 'funccalls' => (
20 is => 'ro',
21 isa => ArrayRef[ Str ],
22 required => 1,
23 );
24  
25 2 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 =head1 NAME
28  
29 JavaScript::Framework::jQuery::Plugin::funcliteral - Add literal JavaScript code to document ready
30  
31 =head1 SYNOPSIS
32  
33 # add literal text to output of $(document).ready(function (){...});
34 my $plugin = JavaScript::Framework::jQuery::Plugin::funcliteral->new(
35 funccalls => [
36 '$("div ul").foobar();',
37 '$("div ul").barfoo();'
38 ]
39 );
40  
41 print $plugin->cons_statement;
42  
43 # $("div ul").foobar();
44 # $("div ul").barfoo();
45  
46  
47 =head1 DESCRIPTION
48  
49 Support for addition of literal function call or other JavaScript code to the
50 body of the $(document).ready(...) call text.
51  
52 =cut
53  
54 =head1 METHODS
55  
56 =cut
57  
58 =head2 cons_statement( )
59  
60 Return the text of the JavaScript statements passed in the constructor,
61 joined with newlines.
62  
63 =cut
64  
65 3 ▶sub cons_statement {
Subroutine cons_statement: called CC=1 SCAR=0.0
Pod documented
66 3 my ( $self ) = @_;
67  
68 3 return join "\n" => @{$self->funccalls};
69 }
70  
71 2 1;
72  
73 __END__
« jQuery/Role/Plugin.pm ↑ Summary jQuery/Subtypes.pm »