Class: Prequel::Sql::InnerJoinedTableRef

Inherits:
Object
  • Object
show all
Defined in:
lib/prequel/sql/inner_joined_table_ref.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left, right, predicate) ⇒ InnerJoinedTableRef

Returns a new instance of InnerJoinedTableRef.



5
6
7
# File 'lib/prequel/sql/inner_joined_table_ref.rb', line 5

def initialize(left, right, predicate)
  @left, @right, @predicate = left, right, predicate
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



4
5
6
# File 'lib/prequel/sql/inner_joined_table_ref.rb', line 4

def left
  @left
end

#predicateObject (readonly)

Returns the value of attribute predicate.



4
5
6
# File 'lib/prequel/sql/inner_joined_table_ref.rb', line 4

def predicate
  @predicate
end

#rightObject (readonly)

Returns the value of attribute right.



4
5
6
# File 'lib/prequel/sql/inner_joined_table_ref.rb', line 4

def right
  @right
end

Instance Method Details

#build_tuple(field_values) ⇒ Object



18
19
20
# File 'lib/prequel/sql/inner_joined_table_ref.rb', line 18

def build_tuple(field_values)
  CompositeTuple.new(left.build_tuple(field_values), right.build_tuple(field_values))
end

#to_sqlObject



9
10
11
12
13
14
15
16
# File 'lib/prequel/sql/inner_joined_table_ref.rb', line 9

def to_sql
  [left.to_sql,
   'inner join',
   right.to_sql,
   'on',
   predicate.to_sql
  ].join(' ')
end