Class: Bmg::Sql::Processor::Join

Inherits:
Bmg::Sql::Processor show all
Includes:
JoinSupport
Defined in:
lib/bmg/sql/processor/join.rb

Constant Summary

Constants inherited from Bmg::Sql::Processor

UnexpectedError

Instance Attribute Summary collapse

Attributes inherited from Bmg::Sql::Processor

#builder

Instance Method Summary collapse

Methods included from JoinSupport

#on_main_exp

Methods inherited from Bmg::Sql::Processor

#on_select_exp, #on_set_operator, #on_with_exp

Constructor Details

#initialize(right, on, builder) ⇒ Join

Returns a new instance of Join.



7
8
9
10
11
# File 'lib/bmg/sql/processor/join.rb', line 7

def initialize(right, on, builder)
  super(builder)
  @right = right
  @on = on
end

Instance Attribute Details

#onObject (readonly)

Returns the value of attribute on.



12
13
14
# File 'lib/bmg/sql/processor/join.rb', line 12

def on
  @on
end

#rightObject (readonly)

Returns the value of attribute right.



12
13
14
# File 'lib/bmg/sql/processor/join.rb', line 12

def right
  @right
end

Instance Method Details

#call(sexpr) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/bmg/sql/processor/join.rb', line 14

def call(sexpr)
  if unjoinable?(sexpr)
    call(builder.from_self(sexpr))
  elsif unjoinable?(right)
    Join.new(builder.from_self(right), on, builder).call(sexpr)
  else
    super(sexpr)
  end
end