Class: Squeel::Nodes::As
Overview
A node representing an SQL alias, which will result in same when visited.
Instance Attribute Summary
Attributes inherited from Binary
Instance Method Summary collapse
-
#initialize(left, right) ⇒ As
constructor
A new instance of As.
- #on(*args) ⇒ Object
Methods inherited from Binary
Methods included from PredicateOperators
Methods inherited from Node
Constructor Details
#initialize(left, right) ⇒ As
Returns a new instance of As.
12 13 14 |
# File 'lib/squeel/nodes/as.rb', line 12 def initialize(left, right) @left, @right = left, right end |
Instance Method Details
#on(*args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/squeel/nodes/as.rb', line 16 def on(*args) raise "only can convert ActiveRecord::Relation to a join node" unless left.is_a?(ActiveRecord::Relation) proc = if block_given? DSL.eval(&Proc.new) else args end SubqueryJoin.new(self, proc) end |