| 1 | package JSONAPI::Document::Role::Attributes; | ||
| 2 | 1 | $JSONAPI::Document::Role::Attributes::VERSION = '2.0'; | |
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | JSONAPI::Document::Role::Attributes - Consumable role to build resource attributes | ||
| 6 | |||
| 7 | =head1 VERSION | ||
| 8 | |||
| 9 | version 2.0 | ||
| 10 | |||
| 11 | =head1 DESCRIPTION | ||
| 12 | |||
| 13 | This role allows you to customize the fetching of a rows attributes. | ||
| 14 | |||
| 15 | Simply add this to the row object and implement the C<attributes> method and it'll | ||
| 16 | be called instead of C<JSONAPI::Document> doing the building of attributes. | ||
| 17 | |||
| 18 | The method is passed a single argument, an C<ArrayRef> of requested fields, | ||
| 19 | which should be honoured in the returned C<HashRef>. | ||
| 20 | |||
| 21 | =head2 attributes(ArrayRef $fields?) : HashRef | ||
| 22 | |||
| 23 | Returns a hashref of columns/attributes for the consuming classes row. | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | 1 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | |||
| 29 | 1 | requires 'attributes'; | |
| 30 | |||
| 31 | 1 | 1; | |