
When true the method will modify the instance in place instead of returning a
new instance.

=item args => \@ARGS

If you wish to pass parameters into the event method being used for filtering,
you may do so here.

=back

=head3 METHODS

=over 4

=item $events->grep($CALL, %PARAMS)

This is essentially:

    Test2::API::InterceptResult->new(
        grep { $_->$CALL( @{$PARAMS{args}} ) } $self->event_list,
    );

B<Note:> that $CALL is called on an upgraded version of the event, though
the events returned will be the original ones, not the upgraded ones.

$CALL may be either the name of a method on
L<Test2::API::InterceptResult::Event>, or a coderef.

=item $events->asserts(%PARAMS)

This is essentially:

    $events->grep(has_assert => @{$PARAMS{args}})

It returns a new instance containing only the events that made assertions.

=item $events->subtests(%PARAMS)

This is essentially:

    $events->grep(has_subtest => @{$PARAMS{args}})

It returns a new instance containing only the events that have subtests.

=item $events->diags(%PARAMS)

This is essentially:

    $events->grep(has_diags => @{$PARAMS{args}})

It returns a new instance containing only the events that have diags.

=item $events->notes(%PARAMS)

This is essentially:

    $events->grep(has_notes => @{$PARAMS{args}})

It returns a new instance containing only the events that have notes.

=item $events->errors(%PARAMS)

B<Note:> Errors are NOT failing assertions. Failing assertions are a different
thing.

This is essentially:

    $events->grep(has_errors => @{$PARAMS{args}})

It returns a new instance containing only the events that have errors.

=item $events->plans(%PARAMS)

This is essentially:

    $events->grep(has_plan => @{$PARAMS{args}})

It returns a new instance containing only the events that set the plan.

=item $events->causes_fail(%PARAMS)

=item $events->causes_failure(%PARAMS)

These are essentially:

    $events->grep(causes_fail    => @{$PARAMS{args}})
    $events->grep(causes_failure => @{$PARAMS{args}})

B<Note:> C<causes_fail()> and C<causes_failure()> are both aliases for
eachother in events, so these methods are effectively aliases here as well.

It returns a new instance containing only the events that cause failure.

=back

=head2 MAPPING

These methods B<ALWAYS> return an arrayref.

B<Note:> No methods on L<Test2::API::InterceptResult::Event> alter the event in
any way.

B<Important Notes about Events>:

L<Test2::API::InterceptResult::Event> was tailor-made to be used in
event-lists. Most methods that are not applicable to a given event will return
an empty list, so you normally do not need to worry about unwanted C<undef>
values or exceptions being thrown. Mapping over event methods is an entended
use, so it works well to produce lists.

B<Exceptions to the rule:>

Some methods such as C<causes_fail> always return a boolean true or false for
all events. Any method prefixed with C<the_> conveys the intent that the event
should have exactly 1 of something, so those will throw an exception when that
condition is not true.

=over 4

=item $arrayref = $events->map($CALL, %PARAMS)

This is essentially:

    [ map { $_->$CALL(@{ $PARAMS{args} }) } $events->upgrade->event_list ];

$CALL may be either the name of a method on
L<Test2::API::InterceptResult::Event>, or a coderef.

=item $arrayref = $events->flatten(%PARAMS)

This is essentially:

    [ map { $_->flatten(@{ $PARAMS{args} }) } $events->upgrade->event_list ];

It returns a new list of flattened structures.

See L<Test2::API::InterceptResult::Event> for details on what C<flatten()>
returns.

=item $arrayref = $events->briefs(%PARAMS)

This is essentially:

    [ map { $_->briefs(@{ $PARAMS{args} }) } $events->upgrade->event_list ];

It returns a new list of event briefs.

See L<Test2::API::InterceptResult::Event> for details on what C<brief()>
returns.

=item $arrayref = $events->summaries(%PARAMS)

This is essentially:

    [ map { $_->summaries(@{ $PARAMS{args} }) } $events->upgrade->event_list ];

It returns a new list of event summaries.

See L<Test2::API::InterceptResult::Event> for details on what C<summary()>
returns.

=item $arrayref = $events->subtest_results(%PARAMS)

This is essentially:

    [ map { $_->subtest_result(@{ $PARAMS{args} }) } $events->upgrade->event_list ];

It returns a new list of event summaries.

See L<Test2::API::InterceptResult::Event> for details on what
C<subtest_result()> returns.

=item $arrayref = $events->diag_messages(%PARAMS)

This is essentially:

    [ map { $_->diag_messages(@{ $PARAMS{args} }) } $events->upgrade->event_list ];

It returns a new list of diagnostic messages (strings).

See L<Test2::API::InterceptResult::Event> for details on what
C<diag_messages()> returns.

=item $arrayref = $events->note_messages(%PARAMS)

This is essentially:

    [ map { $_->note_messages(@{ $PARAMS{args} }) } $events->upgrade->event_list ];

It returns a new list of notification messages (strings).

See L<Test2::API::InterceptResult::Event> for details on what
C<note_messages()> returns.

=item $arrayref = $events->error_messages(%PARAMS)

This is essentially:

    [ map { $_->error_messages(@{ $PARAMS{args} }) } $events->upgrade->event_list ];

It returns a new list of error messages (strings).

See L<Test2::API::InterceptResult::Event> for details on what
C<error_messages()> returns.

=back

=head1 SOURCE

The source code repository for Test2 can be found at
F<http://github.com/Test-More/test-more/>.

=head1 MAINTAINERS

=over 4

=item Chad Granum E<lt>exodist@cpan.orgE<gt>

=back

=head1 AUTHORS

=over 4

=item Chad Granum E<lt>exodist@cpan.orgE<gt>

=back

=head1 COPYRIGHT

Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>.

This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.

See F<http://dev.perl.org/licenses/>

=cut
