File Coverage

blib/lib/DBIx/Class/AuditAny/AuditContext/Column.pm
Criterion Covered Total %
statement 22 23 95.6
branch n/a
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 30 32 93.7


line stmt bran cond sub pod time code
1             package DBIx::Class::AuditAny::AuditContext::Column;
2 13     13   6693 use strict;
  13         23  
  13         358  
3 13     13   49 use warnings;
  13         19  
  13         318  
4              
5             # ABSTRACT: Default 'Column' context object class for DBIx::Class::AuditAny
6              
7             =head1 NAME
8              
9             DBIx::Class::AuditAny::AuditContext::Column - Default 'Column' context object for DBIx::Class::AuditAny
10              
11             =head1 DESCRIPTION
12              
13             This class tracks a single change to a single column, belonging to a parent "Change" context which
14             represents multiple column changes, and the Change may belong to a "ChangeSet" which may comprise
15             multiple different Changes, which of which having 1 or more column change contexts.
16              
17             =cut
18              
19 13     13   48 use Moo;
  13         15  
  13         59  
20 13     13   15962 use MooX::Types::MooseLike::Base qw(:all);
  13         22  
  13         4028  
21             extends 'DBIx::Class::AuditAny::AuditContext';
22              
23 13     13   67 use DBIx::Class::AuditAny::Util;
  13         24  
  13         3724  
24              
25             =head1 ATTRIBUTES
26              
27             Docs regarding the API/purpose of the attributes and methods in this class still TBD...
28              
29             =head2 ChangeContext
30              
31             =head2 column_name
32              
33             =head2 old_value
34              
35             =head2 new_value
36              
37             =cut
38              
39             has 'ChangeContext', is => 'ro', required => 1;
40             has 'column_name', is => 'ro', isa => Str, required => 1;
41             has 'old_value', is => 'ro', isa => Maybe[Str], coerce => sub { $_[0] ? "$_[0]" : $_[0] }, required => 1;
42             has 'new_value', is => 'ro', isa => Maybe[Str], coerce => sub { $_[0] ? "$_[0]" : $_[0] }, required => 1;
43              
44             =head1 METHODS
45              
46             =head2 class
47              
48             =cut
49 0     0 1 0 sub class { (shift)->ChangeContext->class }
50              
51             sub _build_tiedContexts {
52 240     240   1177 my $self = shift;
53 240         364 my @Contexts = ( $self->ChangeContext, @{$self->ChangeContext->tiedContexts} );
  240         3372  
54 240         4046 return \@Contexts;
55             }
56             sub _build_local_datapoint_data {
57 240     240   1143 my $self = shift;
58 240         575 return { map { $_->name => $_->get_value($self) } $self->get_context_datapoints('column') };
  720         1470  
59             }
60              
61              
62             1;
63              
64             __END__
65              
66             =head1 SEE ALSO
67              
68             =over
69              
70             =item *
71              
72             L<DBIx::Class::AuditAny>
73              
74             =item *
75              
76             L<DBIx::Class>
77              
78             =back
79              
80             =head1 SUPPORT
81            
82             IRC:
83            
84             Join #rapidapp on irc.perl.org.
85              
86             =head1 AUTHOR
87              
88             Henry Van Styn <vanstyn@cpan.org>
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is copyright (c) 2012-2015 by IntelliTree Solutions llc.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =cut