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 14     14   8018 use strict;
  14         38  
  14         488  
3 14     14   82 use warnings;
  14         44  
  14         423  
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 14     14   89 use Moo;
  14         40  
  14         116  
20 14     14   22662 use MooX::Types::MooseLike::Base qw(:all);
  14         45  
  14         4837  
21             extends 'DBIx::Class::AuditAny::AuditContext';
22              
23 14     14   132 use DBIx::Class::AuditAny::Util;
  14         36  
  14         5449  
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 253     253   2309 my $self = shift;
53 253         611 my @Contexts = ( $self->ChangeContext, @{$self->ChangeContext->tiedContexts} );
  253         4050  
54 253         5819 return \@Contexts;
55             }
56             sub _build_local_datapoint_data {
57 253     253   2282 my $self = shift;
58 253         800 return { map { $_->name => $_->get_value($self) } $self->get_context_datapoints('column') };
  759         2147  
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