NAME
App::Codeowners::Formatter - Base class for formatting codeowners output
VERSION
version 0.51
SYNOPSIS
my $formatter = App::Codeowners::Formatter->new(handle => *STDOUT);
$formatter->add_result($_) for @results;
DESCRIPTION
This is a base class for formatters. A formatter is a class that takes data records, stringifies them, and prints them to an IO handle.
This class is mostly abstract, though it is also usable as a null formatter where results are simply discarded if it is instantiated directly. These other formatters do more interesting things:
ATTRIBUTES
handle
Get the IO handle associated with a formatter.
format
Get the format string, which may be used to customize the formatting.
columns
Get an arrayref of column headings.
results
Get an arrayref of all the results that have been provided to the formatter using "add_result" but have not yet been formatted.
METHODS
new
$formatter = App::Codeowners::Formatter->new;
$formatter = App::Codeowners::Formatter->new(%attributes);
Construct a new formatter.
DESTROY
Destructor calls "finish".
add_result
$formatter->add_result($result);
Provide an additional result to be formatted.
start
$formatter->start;
Begin formatting results. Called before any results are passed to the "stream" method.
This method may print a header to the "handle". This method is used by subclasses and should typically not be called explicitly.
stream
$formatter->stream(\@result, ...);
Format one result.
This method is expected to print a string representation of the result to the "handle". This method is used by subclasses and should typically not called be called explicitly.
The default implementation simply stores the "results" so they will be available to "finish".
finish
$formatter->finish;
End formatting results. Called after all results are passed to the "stream" method.
This method may print a footer to the "handle". This method is used by subclasses and should typically not be called explicitly.
formatters
@formatters = App::Codeowners::Formatter->formatters;
Get a list of package names of potential formatters within the App::Codeowners::Formatter
namespace.
BUGS
Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/git-codeowners/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
AUTHOR
Charles McGarvey <chazmcgarvey@brokenzipper.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2021 by Charles McGarvey.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.