File Coverage

blib/lib/Sieve/Generator/Element/Terms.pm
Criterion Covered Total %
statement 16 21 76.1
branch 2 2 100.0
condition 1 2 50.0
subroutine 4 5 80.0
pod 0 2 0.0
total 23 32 71.8


line stmt bran cond sub pod time code
1 1     1   9 use v5.36.0;
  1         3  
2             package Sieve::Generator::Element::Terms 0.003;
3             # ABSTRACT: a sequence of Sieve terms joined by spaces
4              
5 1     1   4 use Moo;
  1         2  
  1         4  
6             with 'Sieve::Generator::Element';
7              
8             #pod =head1 DESCRIPTION
9             #pod
10             #pod A C object renders a sequence of terms as a space-joined inline Sieve
11             #pod expression. It is the general-purpose building block for Sieve test
12             #pod expressions and argument sequences.
13             #pod
14             #pod =attr terms
15             #pod
16             #pod This attribute holds the arrayref of terms. Each term may be a plain string or
17             #pod an object doing L; all terms are joined with single
18             #pod spaces when rendered.
19             #pod
20             #pod =cut
21              
22             has terms => (is => 'ro', required => 1);
23              
24 0     0 0 0 sub children ($self) { grep { ref } $self->terms->@* }
  0         0  
  0         0  
  0         0  
  0         0  
25              
26 14     14 0 13 sub as_sieve ($self, $i = undef) {
  14         16  
  14         12  
  14         13  
27 14   50     16 $i //= 0;
28              
29             my $str = (q{ } x $i)
30             . join q{ },
31 14 100       42 map {; ref($_) ? $_->as_sieve : $_ }
  21         47  
32             $self->terms->@*;
33              
34 14         25 return $str;
35             }
36              
37 1     1   397 no Moo;
  1         1  
  1         3  
38             1;
39              
40             __END__