File Coverage

blib/lib/Pinto/Role/Schema/Result.pm
Criterion Covered Total %
statement 9 12 75.0
branch n/a
condition n/a
subroutine 3 4 75.0
pod 0 2 0.0
total 12 18 66.6


line stmt bran cond sub pod time code
1             # ABSTRACT: Attributes and methods for all Schema::Result objects
2              
3             package Pinto::Role::Schema::Result;
4              
5 54     54   31153 use Moose::Role;
  54         132  
  54         632  
6 54     54   300082 use MooseX::MarkAsMethods ( autoclean => 1 );
  54         140  
  54         535  
7              
8             #------------------------------------------------------------------------------
9              
10             our $VERSION = '0.13'; # VERSION
11              
12             #------------------------------------------------------------------------------
13              
14             has repo => (
15             is => 'ro',
16             isa => 'Pinto::Repository',
17             default => sub { $_[0]->result_source->schema->repo },
18             init_arg => undef,
19             lazy => 1,
20             );
21              
22             #------------------------------------------------------------------------------
23              
24             sub refresh {
25 1368     1368 0 1207512 my ($self) = @_;
26              
27 1368         11612 $self->discard_changes;
28              
29 1368         124650 return $self;
30             }
31              
32             #------------------------------------------------------------------------------
33              
34             sub refresh_column {
35 0     0 0   my ( $self, $column ) = @_;
36              
37 0           $self->mark_column_dirty($column);
38              
39 0           return $self->get_column($column);
40             }
41              
42             #------------------------------------------------------------------------------
43              
44             1;
45              
46             __END__
47              
48             =pod
49              
50             =encoding UTF-8
51              
52             =for :stopwords Jeffrey Ryan Thalhammer
53              
54             =head1 NAME
55              
56             Pinto::Role::Schema::Result - Attributes and methods for all Schema::Result objects
57              
58             =head1 VERSION
59              
60             version 0.13
61              
62             =head1 DESCRIPTION
63              
64             This role adds a L<Pinto::Repository> attributes. It should only be
65             applied to L<Pinto::Schema::Result> subclasses, as it will reach into
66             the underlying L<Pinto::Schema> object to get at the repo.
67              
68             This gives us a back door for injecting additional attributes into
69             L<Pinto::Schema::Result> objects, since those are usually created by
70             L<DBIx::Class> and we don't have control over the construction
71             process.
72              
73             =head1 AUTHOR
74              
75             Jeffrey Ryan Thalhammer <jeff@stratopan.com>
76              
77             =head1 COPYRIGHT AND LICENSE
78              
79             This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer.
80              
81             This is free software; you can redistribute it and/or modify it under
82             the same terms as the Perl 5 programming language system itself.
83              
84             =cut