Meta/Attribute/FromInflator.pm

filter: Statementstmt 100% 23 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 30 / 30 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Meta/Attribute/FromColumn.pm ↑ Summary Meta/HasMany/ViaSelect.pm »
1 package Fey::Meta::Attribute::FromInflator;
2 {
3 10 $Fey::Meta::Attribute::FromInflator::VERSION = '0.46';
4 }
5  
6 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 10 ▶use Fey::ORM::Types qw( CodeRef );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 10 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 10 extends 'Moose::Meta::Attribute';
15  
16 10 has 'inflator' => (
17 is => 'ro',
18 isa => CodeRef,
19 required => 1,
20 );
21  
22 10 has 'raw_attribute' => (
23 is => 'ro',
24 isa => 'Fey::Meta::Attribute::FromColumn',
25 required => 1,
26 );
27  
28 sub column {
29 1 ▶ return $_[0]->raw_attribute()->column();
Subroutine column: called CC=1 SCAR=0.0
Pod documented
30 }
31  
32 # The parent class's constructor is not a Moose::Object-based
33 # constructor, so we don't want to inline one that is.
34 10 __PACKAGE__->meta()->make_immutable( inline_constructor => 0 );
35  
36 10 1;
37  
38 # ABSTRACT: An attribute metaclass for attributes with an inflator
39  
40 __END__
41  
42 =pod
43  
44 =head1 NAME
45  
46 Fey::Meta::Attribute::FromInflator - An attribute metaclass for attributes with an inflator
47  
48 =head1 VERSION
49  
50 version 0.46
51  
52 =head1 SYNOPSIS
53  
54 package MyApp::Song;
55  
56 has_table( $schema->table('Song') );
57  
58 for my $attr ( grep { $_->can('raw_attribute') } $self->meta()->get_all_attributes )
59 {
60 ...
61 }
62  
63 =head1 DESCRIPTION
64  
65 This attribute metaclass is used when L<Fey::ORM::Table> creates
66 attributes based on an inflator transform.
67  
68 =head1 METHODS
69  
70 This class adds a two methods to those provided by
71 C<Moose::Meta::Attribute>:
72  
73 =head2 $attr->raw_attribute()
74  
75 Returns the attribute for the raw version of this data. This is the
76 original attribute created for the column, which was renamed when the
77 inflator was declared.
78  
79 =head2 $attr->column()
80  
81 Returns the L<Fey::Column> object associated with the raw attribute.
82  
83 =head1 AUTHOR
84  
85 Dave Rolsky <autarch@urth.org>
86  
87 =head1 COPYRIGHT AND LICENSE
88  
89 This software is copyright (c) 2011 by Dave Rolsky.
90  
91 This is free software; you can redistribute it and/or modify it under
92 the same terms as the Perl 5 programming language system itself.
93  
94 =cut
« Meta/Attribute/FromColumn.pm ↑ Summary Meta/HasMany/ViaSelect.pm »