File Coverage

blib/lib/Slack/BlockKit/Block/RichText.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 23 23 100.0


line stmt bran cond sub pod time code
1             package Slack::BlockKit::Block::RichText 0.005;
2             # ABSTRACT: the top-level rich text block in Block Kit
3              
4 4     4   29 use Moose;
  4         19  
  4         36  
5 4     4   38976 use MooseX::StrictConstructor;
  4         69503  
  4         17  
6 4     4   34801 use Slack::BlockKit::Types qw(RichTextBlocks);
  4         17  
  4         57  
7              
8             #pod =head1 OVERVIEW
9             #pod
10             #pod The RichText block is pretty boring, but must exist to contain all the other
11             #pod rich text object:
12             #pod
13             #pod =for :list
14             #pod * L<User |Slack::BlockKit::Block::RichText::User>
15             #pod * L<Link |Slack::BlockKit::Block::RichText::Link>
16             #pod * L<UserGroup |Slack::BlockKit::Block::RichText::UserGroup>
17             #pod * L<List |Slack::BlockKit::Block::RichText::List>
18             #pod * L<Channel |Slack::BlockKit::Block::RichText::Channel>
19             #pod * L<Emoji |Slack::BlockKit::Block::RichText::Emoji>
20             #pod * L<Quote |Slack::BlockKit::Block::RichText::Quote>
21             #pod * L<Preformatted|Slack::BlockKit::Block::RichText::Preformatted>
22             #pod * L<Section |Slack::BlockKit::Block::RichText::Section>
23             #pod * L<Text |Slack::BlockKit::Block::RichText::Text>
24             #pod
25             #pod As usual, these classes are I<lightly> documented in the Slack::BlockKit
26             #pod distribution, but to really understand how they're meant to be used, see the
27             #pod Slack Block Kit documentation on Slack.
28             #pod
29             #pod =cut
30              
31             with 'Slack::BlockKit::Role::Block';
32              
33 4     4   7643 use v5.36.0;
  4         15  
34              
35             #pod =attr elements
36             #pod
37             #pod This must be an arrayref of the kinds of objects that are permitted within a
38             #pod rich test block:
39             #pod
40             #pod =for :list
41             #pod * L<List |Slack::BlockKit::Block::RichText::List>
42             #pod * L<Quote |Slack::BlockKit::Block::RichText::Quote>
43             #pod * L<Preformatted|Slack::BlockKit::Block::RichText::Preformatted>
44             #pod * L<Section |Slack::BlockKit::Block::RichText::Section>
45             #pod
46             #pod =cut
47              
48             has elements => (
49             isa => RichTextBlocks(),
50             traits => [ 'Array' ],
51             handles => { elements => 'elements' },
52             );
53              
54             sub as_struct ($self) {
55             return {
56             type => 'rich_text',
57             elements => [ map {; $_->as_struct } $self->elements ],
58             };
59             }
60              
61 4     4   47 no Slack::BlockKit::Types;
  4         8  
  4         121  
62 4     4   59 no Moose;
  4         25  
  4         34  
63             __PACKAGE__->meta->make_immutable;
64              
65             __END__
66              
67             =pod
68              
69             =encoding UTF-8
70              
71             =head1 NAME
72              
73             Slack::BlockKit::Block::RichText - the top-level rich text block in Block Kit
74              
75             =head1 VERSION
76              
77             version 0.005
78              
79             =head1 OVERVIEW
80              
81             The RichText block is pretty boring, but must exist to contain all the other
82             rich text object:
83              
84             =over 4
85              
86             =item *
87              
88             L<User |Slack::BlockKit::Block::RichText::User>
89              
90             =item *
91              
92             L<Link |Slack::BlockKit::Block::RichText::Link>
93              
94             =item *
95              
96             L<UserGroup |Slack::BlockKit::Block::RichText::UserGroup>
97              
98             =item *
99              
100             L<List |Slack::BlockKit::Block::RichText::List>
101              
102             =item *
103              
104             L<Channel |Slack::BlockKit::Block::RichText::Channel>
105              
106             =item *
107              
108             L<Emoji |Slack::BlockKit::Block::RichText::Emoji>
109              
110             =item *
111              
112             L<Quote |Slack::BlockKit::Block::RichText::Quote>
113              
114             =item *
115              
116             L<Preformatted|Slack::BlockKit::Block::RichText::Preformatted>
117              
118             =item *
119              
120             L<Section |Slack::BlockKit::Block::RichText::Section>
121              
122             =item *
123              
124             L<Text |Slack::BlockKit::Block::RichText::Text>
125              
126             =back
127              
128             As usual, these classes are I<lightly> documented in the Slack::BlockKit
129             distribution, but to really understand how they're meant to be used, see the
130             Slack Block Kit documentation on Slack.
131              
132             =head1 PERL VERSION
133              
134             This module should work on any version of perl still receiving updates from
135             the Perl 5 Porters. This means it should work on any version of perl
136             released in the last two to three years. (That is, if the most recently
137             released version is v5.40, then this module should work on both v5.40 and
138             v5.38.)
139              
140             Although it may work on older versions of perl, no guarantee is made that the
141             minimum required version will not be increased. The version may be increased
142             for any reason, and there is no promise that patches will be accepted to
143             lower the minimum required perl.
144              
145             =head1 ATTRIBUTES
146              
147             =head2 elements
148              
149             This must be an arrayref of the kinds of objects that are permitted within a
150             rich test block:
151              
152             =over 4
153              
154             =item *
155              
156             L<List |Slack::BlockKit::Block::RichText::List>
157              
158             =item *
159              
160             L<Quote |Slack::BlockKit::Block::RichText::Quote>
161              
162             =item *
163              
164             L<Preformatted|Slack::BlockKit::Block::RichText::Preformatted>
165              
166             =item *
167              
168             L<Section |Slack::BlockKit::Block::RichText::Section>
169              
170             =back
171              
172             =head1 AUTHOR
173              
174             Ricardo SIGNES <cpan@semiotic.systems>
175              
176             =head1 COPYRIGHT AND LICENSE
177              
178             This software is copyright (c) 2024 by Ricardo SIGNES.
179              
180             This is free software; you can redistribute it and/or modify it under
181             the same terms as the Perl 5 programming language system itself.
182              
183             =cut