Class: ActiveRecord::Refined::AST::As

Inherits:
Node
  • Object
show all
Defined in:
lib/active_record/refined/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#as, #asc, #desc

Constructor Details

#initialize(operand, alias_name) ⇒ As

Returns a new instance of As.



150
151
152
153
# File 'lib/active_record/refined/ast.rb', line 150

def initialize(operand, alias_name)
  @operand = operand
  @alias_name = alias_name
end

Instance Attribute Details

#alias_nameObject (readonly)

Returns the value of attribute alias_name.



148
149
150
# File 'lib/active_record/refined/ast.rb', line 148

def alias_name
  @alias_name
end

#operandObject (readonly)

Returns the value of attribute operand.



148
149
150
# File 'lib/active_record/refined/ast.rb', line 148

def operand
  @operand
end

Instance Method Details

#to_arel(table) ⇒ Object



155
156
157
# File 'lib/active_record/refined/ast.rb', line 155

def to_arel(table)
  to_arel_operand(operand, table).as(alias_name.to_s)
end