Class: ActiveRecord::Refined::AST::As
- Defined in:
- lib/active_record/refined/ast.rb
Instance Attribute Summary collapse
-
#alias_name ⇒ Object
readonly
Returns the value of attribute alias_name.
-
#operand ⇒ Object
readonly
Returns the value of attribute operand.
Instance Method Summary collapse
-
#initialize(operand, alias_name) ⇒ As
constructor
A new instance of As.
- #to_arel(table) ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(operand, alias_name) ⇒ As
Returns a new instance of As.
366 367 368 369 |
# File 'lib/active_record/refined/ast.rb', line 366 def initialize(operand, alias_name) @operand = operand @alias_name = AST.check_name(alias_name, ALIAS_NAME, "column alias") end |
Instance Attribute Details
#alias_name ⇒ Object (readonly)
Returns the value of attribute alias_name.
364 365 366 |
# File 'lib/active_record/refined/ast.rb', line 364 def alias_name @alias_name end |
#operand ⇒ Object (readonly)
Returns the value of attribute operand.
364 365 366 |
# File 'lib/active_record/refined/ast.rb', line 364 def operand @operand end |
Instance Method Details
#to_arel(table) ⇒ Object
371 372 373 |
# File 'lib/active_record/refined/ast.rb', line 371 def to_arel(table) to_arel_operand(operand, table).as(alias_name.to_s) end |