File Coverage

lib/DBIx/ActiveRecord/Arel/Join.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 19 21 90.4


line stmt bran cond sub pod time code
1             package DBIx::ActiveRecord::Arel::Join;
2 2     2   8 use strict;
  2         3  
  2         67  
3 2     2   10 use warnings;
  2         3  
  2         324  
4              
5             sub new {
6 16     16 0 27 my ($self, $join_type, $primary_key_column, $foreign_key_column) = @_;
7 16         97 bless {type => $join_type, pk => $primary_key_column, fk => $foreign_key_column}, $self;
8             }
9              
10             sub build {
11 18     18 0 18 my $self = shift;
12 18         51 my $table = $self->{fk}->table->table;
13 18         28 my $alias = $DBIx::ActiveRecord::Arel::Column::AS->{$table};
14 18 100       35 $table .= " $alias" if $alias;
15 18         61 $self->{type}.' '.$table.' ON '.$self->{fk}->name.' = '.$self->{pk}->name;
16             }
17              
18             1;