blib/lib/Test/BDD/Cucumber/Model/Document.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 2 SCAR 2.2
CC
2
Cov
100%
BUILD
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Test/BDD/Cucumber/Harness.pm ↑ Summary blib/lib/Test/BDD/Cucumber/Extension.pm »
1 27 ▶use v5.14;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 27 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Test::BDD::Cucumber::Model::Document 0.87;
5  
6 27 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 27 ▶use Types::Standard qw( Str ArrayRef InstanceOf );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 27 ▶use Test::BDD::Cucumber::Model::Line;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 Test::BDD::Cucumber::Model::Document - Model to represent a feature file on disk or in memory
13  
14 =head1 VERSION
15  
16 version 0.87
17  
18 =head1 DESCRIPTION
19  
20 Model to represent a feature file on disk or in memory
21  
22 =head1 ATTRIBUTES
23  
24 =head2 filename
25  
26 The filename from which the document was loaded.
27  
28 =cut
29  
30 27 has 'filename' => ( is => 'ro', isa => Str );
31  
32 =head2 content
33  
34 The file contents, as a string
35  
36 =cut
37  
38 27 has 'content' => ( is => 'ro', isa => Str );
39  
40 =head2 lines
41  
42 The file contents, as an arrayref of L<Test::BDD::Cucumber::Model::Line>
43 objects
44  
45 =cut
46  
47 has 'lines' => (
48 is => 'rw',
49 61 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
50 27 isa => ArrayRef[InstanceOf['Test::BDD::Cucumber::Model::Line']]
51 );
52  
53 =head1 OTHER
54  
55 =head2 BUILD
56  
57 The instantiation populates C<lines()> by splitting the input on newlines.
58  
59 =cut
60  
61 # Create lines
62 61 ▶sub BUILD {
Subroutine BUILD: called CC=2 SCAR=6.9
Pod documented
63 61 my $self = shift;
64  
65 # Reset any content that was in lines
66 61 my $counter = 0;
67  
68 61 for my $line ( split( /\n/, $self->content ) ) {
69 1735 my $obj = Test::BDD::Cucumber::Model::Line->new(
70 {
71 number => ++$counter,
72 document => $self,
73 raw_content => $line
74 }
75 );
76 1735 push( @{ $self->lines }, $obj );
77 }
78 }
79  
80 =head1 AUTHOR
81  
82 Peter Sergeant C<pete@clueball.com>
83  
84 =head1 LICENSE
85  
86 Copyright 2019-2023, Erik Huelsmann
87 Copyright 2011-2019, Peter Sergeant; Licensed under the same terms as Perl
88  
89 =cut
90  
91 27 1;
« blib/lib/Test/BDD/Cucumber/Harness.pm ↑ Summary blib/lib/Test/BDD/Cucumber/Extension.pm »