Refactored native trait accessors so they are done entirely in roles.
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / push.pm
1 package Moose::Meta::Method::Accessor::Native::Array::push;
2
3 use strict;
4 use warnings;
5
6 our $VERSION = '1.14';
7 $VERSION = eval $VERSION;
8 our $AUTHORITY = 'cpan:STEVAN';
9
10 use Moose::Role;
11
12 with 'Moose::Meta::Method::Accessor::Native::Array::Writer' =>
13     { -excludes => ['_inline_optimized_set_new_value'] };
14
15 sub _adds_members { 1 }
16
17 sub _potential_value {
18     my ( $self, $slot_access ) = @_;
19
20     return "[ \@{ $slot_access }, \@_ ]";
21 }
22
23 sub _inline_optimized_set_new_value {
24     my ( $self, $inv, $new, $slot_access ) = @_;
25
26     return "push \@{ $slot_access }, \@_";
27 }
28
29 no Moose::Role;
30
31 1;