File Coverage

blib/lib/Org/Element/TableRow.pm
Criterion Covered Total %
statement 24 24 100.0
branch 3 6 50.0
condition n/a
subroutine 6 6 100.0
pod 3 3 100.0
total 36 39 92.3


line stmt bran cond sub pod time code
1             package Org::Element::TableRow;
2              
3 5     5   1104 use 5.010;
  5         20  
4 5     5   28 use locale;
  5         12  
  5         23  
5 5     5   154 use Moo;
  5         8  
  5         32  
6             extends 'Org::Element';
7              
8             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
9             our $DATE = '2023-08-05'; # DATE
10             our $DIST = 'Org-Parser'; # DIST
11             our $VERSION = '0.560'; # VERSION
12              
13             sub as_string {
14 1     1 1 5 my ($self) = @_;
15 1 50       11 return $self->_str if defined $self->_str;
16              
17             join("",
18             "|",
19 1         5 join("|", map {$_->as_string} @{$self->children}),
  3         10  
  1         4  
20             "\n");
21             }
22              
23             sub as_array {
24 5     5 1 12 my ($self) = @_;
25              
26 5         9 [map {$_->as_string} @{$self->children}];
  13         29  
  5         14  
27             }
28              
29             sub cells {
30 1     1 1 5 my ($self) = @_;
31 1 50       5 return [] unless $self->children;
32              
33 1         14 my $cells = [];
34 1         4 for my $el (@{$self->children}) {
  1         7  
35 3 50       15 push @$cells, $el if $el->isa('Org::Element::TableCell');
36             }
37 1         9 $cells;
38             }
39              
40             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