File Coverage

lib/DBIx/ActiveRecord/Arel/Order.pm
Criterion Covered Total %
statement 12 16 75.0
branch 2 4 50.0
condition n/a
subroutine 4 5 80.0
pod 0 3 0.0
total 18 28 64.2


line stmt bran cond sub pod time code
1             package DBIx::ActiveRecord::Arel::Order;
2 2     2   10 use strict;
  2         4  
  2         67  
3 2     2   9 use warnings;
  2         4  
  2         487  
4              
5             sub new {
6 7     7 0 8 my ($self, $type, $column) = @_;
7 7         43 bless {type => $type, column => $column}, $self;
8             }
9              
10             sub build {
11 5     5 0 5 my $self = shift;
12 5         6 my $t = $self->{type};
13 5 100       12 $t = " $t" if $t;
14 5         14 $self->{column}->name.$t;
15             }
16              
17             sub reverse {
18 0     0 0   my $self = shift;
19 0 0         if ($self->{type} eq 'DESC') {
20 0           $self->{type} = "";
21             } else {
22 0           $self->{type} = "DESC";
23             }
24             }
25              
26             1;