Fey/Role/ColumnLike.pm

filter: Statementstmt 100% 22 / 22 Branchbran 90.0% 9 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 4 / 4 totaltotal 97.7% 44 / 45 SCAR 17.9
CC
6
Cov
97%
_containing_table_name_or_alias
2.1
is_selectable
2.0
is_comparable
2.0
CRAP 6.0
« Fey/Literal/Term.pm ↑ Summary Fey/Role/SQL/HasOrderByClause.pm »
1 package Fey::Role::ColumnLike;
2  
3 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 26 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 26 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 26 our $VERSION = '0.43';
8  
9 26 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # This seems weird, but basically we're saying that column-like things
12 # do these four roles, but the implementation is different for
13 # column-like things (than for example, selectable things).
14 26 with(
15 'Fey::Role::Selectable' => { -excludes => 'is_selectable' },
16 'Fey::Role::Comparable' => { -excludes => 'is_comparable' },
17 'Fey::Role::Groupable' => { -excludes => 'is_groupable' },
18 'Fey::Role::Orderable' => { -excludes => 'is_orderable' },
19 );
20  
21 26 requires '_build_id', 'is_alias';
22  
23 sub _containing_table_name_or_alias {
24 140 ▶ my $t = $_[0]->table();
Subroutine _containing_table_name_or_alias: called CC=2 SCAR=7.2
25  
26 140 ▶ $t->is_alias() ? $t->alias_name() : $t->name();
Branch: 1 branch
BranchTrueFalseTotal
$t->is_alias ? : 0 140 140
27 }
28  
29 27 ▶sub is_selectable { return $_[0]->table() ? 1 : 0 }
Subroutine is_selectable: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->table ? : 26 1 27
30  
31 86 ▶sub is_comparable { return $_[0]->table() ? 1 : 0 }
Subroutine is_comparable: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->table ? : 85 1 86
32  
33 5 ▶sub is_groupable { return $_[0]->table() ? 1 : 0 }
Subroutine is_groupable: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->table ? : 4 1 5
34  
35 18 ▶sub is_orderable { return $_[0]->table() ? 1 : 0 }
Subroutine is_orderable: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->table ? : 17 1 18
36  
37 26 1;
38  
39 # ABSTRACT: A role for "column-like" behavior
40  
41 __END__
42  
43 =pod
44  
45 =head1 NAME
46  
47 Fey::Role::ColumnLike - A role for "column-like" behavior
48  
49 =head1 VERSION
50  
51 version 0.43
52  
53 =head1 SYNOPSIS
54  
55 use Moose 2.1200;
56  
57 with 'Fey::Role::ColumnLike';
58  
59 =head1 DESCRIPTION
60  
61 Class which do this role are "column-like" . This role aggregates
62 several other roles for the L<Fey::Column> and L<Fey::Column::Alias>
63 classes.
64  
65 =head1 METHODS
66  
67 This role provides the following methods:
68  
69 =head2 $column->is_selectable()
70  
71 =head2 $column->is_comparable()
72  
73 =head2 $column->is_groupable()
74  
75 =head2 $column->is_orderable()
76  
77 These methods all return true when the C<< $column->table() >>
78 returns an object.
79  
80 =head1 ROLES
81  
82 This class does the C<Fey::Role::Selectable>,
83 C<Fey::Role::Comparable>, C<Fey::Role::Groupable>, and
84 C<Fey::Role::Orderable> roles.
85  
86 =head1 BUGS
87  
88 See L<Fey> for details on how to report bugs.
89  
90 =head1 AUTHOR
91  
92 Dave Rolsky <autarch@urth.org>
93  
94 =head1 COPYRIGHT AND LICENSE
95  
96 This software is Copyright (c) 2011 - 2015 by Dave Rolsky.
97  
98 This is free software, licensed under:
99  
100 The Artistic License 2.0 (GPL Compatible)
101  
102 =cut
« Fey/Literal/Term.pm ↑ Summary Fey/Role/SQL/HasOrderByClause.pm »