File Coverage

blib/lib/Slack/BlockKit/Block/RichText/Section.pm
Criterion Covered Total %
statement 17 22 77.2
branch n/a
condition n/a
subroutine 6 7 85.7
pod 0 1 0.0
total 23 30 76.6


line stmt bran cond sub pod time code
1             package Slack::BlockKit::Block::RichText::Section 0.005;
2             # ABSTRACT: a collection of rich text elements
3              
4 4     4   27 use Moose;
  4         24  
  4         40  
5 4     4   19489 use MooseX::StrictConstructor;
  4         18  
  4         40  
6              
7 4     4   13318 use Slack::BlockKit::Types qw(ExpansiveElementList);
  4         9  
  4         44  
8              
9             #pod =head1 OVERVIEW
10             #pod
11             #pod This object represents a rich text section, which is just an array of rich text
12             #pod elements. For more info on what you can put in a rich text section, consult
13             #pod the Slack docs.
14             #pod
15             #pod =cut
16              
17 4     4   8345 use v5.36.0;
  4         14  
18              
19             #pod =attr elements
20             #pod
21             #pod This must be an arrayref of RichText element objects, from the approved list
22             #pod according to the Block Kit docs.
23             #pod
24             #pod =cut
25              
26             has elements => (
27             isa => ExpansiveElementList(),
28             traits => [ 'Array' ],
29             handles => { elements => 'elements' },
30             );
31              
32 0     0 0   sub as_struct ($self) {
  0            
  0            
33             return {
34             type => 'rich_text_section',
35 0           elements => [ map {; $_->as_struct } $self->elements ],
  0            
36             };
37             }
38              
39 4     4   28 no Moose;
  4         7  
  4         26  
40 4     4   962 no Slack::BlockKit::Types;
  4         9  
  4         177  
41             __PACKAGE__->meta->make_immutable;
42              
43             __END__
44              
45             =pod
46              
47             =encoding UTF-8
48              
49             =head1 NAME
50              
51             Slack::BlockKit::Block::RichText::Section - a collection of rich text elements
52              
53             =head1 VERSION
54              
55             version 0.005
56              
57             =head1 OVERVIEW
58              
59             This object represents a rich text section, which is just an array of rich text
60             elements. For more info on what you can put in a rich text section, consult
61             the Slack docs.
62              
63             =head1 PERL VERSION
64              
65             This module should work on any version of perl still receiving updates from
66             the Perl 5 Porters. This means it should work on any version of perl
67             released in the last two to three years. (That is, if the most recently
68             released version is v5.40, then this module should work on both v5.40 and
69             v5.38.)
70              
71             Although it may work on older versions of perl, no guarantee is made that the
72             minimum required version will not be increased. The version may be increased
73             for any reason, and there is no promise that patches will be accepted to
74             lower the minimum required perl.
75              
76             =head1 ATTRIBUTES
77              
78             =head2 elements
79              
80             This must be an arrayref of RichText element objects, from the approved list
81             according to the Block Kit docs.
82              
83             =head1 AUTHOR
84              
85             Ricardo SIGNES <cpan@semiotic.systems>
86              
87             =head1 COPYRIGHT AND LICENSE
88              
89             This software is copyright (c) 2024 by Ricardo SIGNES.
90              
91             This is free software; you can redistribute it and/or modify it under
92             the same terms as the Perl 5 programming language system itself.
93              
94             =cut