Element/TableRow.pm

filter: Statementstmt 100% 30 / 30 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 3 / 3 totaltotal 93.3% 42 / 45 SCAR 16.1
CC
5
Cov
92%
cells
4.1
as_string
2.0
BEGIN
1.0
CRAP 5.0
« Element/Link.pm ↑ Summary Element/List.pm »
1 package Org::Element::TableRow;
2  
3 6 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use locale;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 extends 'Org::Element';
7  
8 6 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
9 6 our $DATE = '2023-08-05'; # DATE
10 6 our $DIST = 'Org-Parser'; # DIST
11 6 our $VERSION = '0.560'; # VERSION
12  
13 sub as_string {
14 1 ▶ my ($self) = @_;
Subroutine as_string: called CC=2 SCAR=7.0
Pod documented
15 1 ▶ return $self->_str if defined $self->_str;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->_str 0 1 1
16  
17 join("",
18 "|",
19 1 join("|", map {$_->as_string} @{$self->children}),
20 "\n");
21 }
22  
23 sub as_array {
24 5 ▶ my ($self) = @_;
Subroutine as_array: called CC=1 SCAR=0.0
Pod documented
25  
26 5 [map {$_->as_string} @{$self->children}];
27 }
28  
29 sub cells {
30 1 ▶ my ($self) = @_;
Subroutine cells: called CC=4 SCAR=14.1
Pod documented
31 1 ▶ return [] unless $self->children;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->children 0 1 1
32  
33 1 my $cells = [];
34 1 for my $el (@{$self->children}) {
35 3 ▶ push @$cells, $el if $el->isa('Org::Element::TableCell');
Branch: 1 branch
BranchTrueFalseTotal
if $el->isa("Org::Element::TableCell") 3 0 3
36 }
37 1 $cells;
38 }
39  
40 6 1;
41 # ABSTRACT: Represent Org table row
42  
43 __END__
44  
45 =pod
46  
47 =encoding UTF-8
48  
49 =head1 NAME
50  
51 Org::Element::TableRow - Represent Org table row
52  
53 =head1 VERSION
54  
55 This document describes version 0.560 of Org::Element::TableRow (from Perl distribution Org-Parser), released on 2023-08-05.
56  
57 =head1 DESCRIPTION
58  
59 Derived from L<Org::Element>. Must have L<Org::Element::TableCell>
60 instances as its children.
61  
62 =for Pod::Coverage as_string
63  
64 =head1 ATTRIBUTES
65  
66 =head1 METHODS
67  
68 =head2 $table->cells() => ELEMENTS
69  
70 Return the cells of the row.
71  
72 =head2 $table->as_array() => ARRAY
73  
74 Return an arrayref containing the cells of the row, each cells already
75 stringified with as_string().
76  
77 =head1 HOMEPAGE
78  
79 Please visit the project's homepage at L<https://metacpan.org/release/Org-Parser>.
80  
81 =head1 SOURCE
82  
83 Source repository is at L<https://github.com/perlancar/perl-Org-Parser>.
84  
85 =head1 AUTHOR
86  
87 perlancar <perlancar@cpan.org>
88  
89 =head1 CONTRIBUTING
90  
91  
92 To contribute, you can send patches by email/via RT, or send pull requests on
93 GitHub.
94  
95 Most of the time, you don't need to build the distribution yourself. You can
96 simply modify the code, then test via:
97  
98 % prove -l
99  
100 If you want to build the distribution (e.g. to try to install it locally on your
101 system), you can install L<Dist::Zilla>,
102 L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
103 L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
104 Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
105 that are considered a bug and can be reported to me.
106  
107 =head1 COPYRIGHT AND LICENSE
108  
109 This software is copyright (c) 2023, 2022, 2021, 2020, 2019, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <perlancar@cpan.org>.
110  
111 This is free software; you can redistribute it and/or modify it under
112 the same terms as the Perl 5 programming language system itself.
113  
114 =head1 BUGS
115  
116 Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Org-Parser>
117  
118 When submitting a bug or request, please include a test-file or a
119 patch to an existing test-file that illustrates the bug or desired
120 feature.
121  
122 =cut
« Element/Link.pm ↑ Summary Element/List.pm »