Class: ParamsReady::Helpers::ArelBuilder::Table::Literal

Inherits:
Literal
  • Object
show all
Defined in:
lib/params_ready/helpers/arel_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(literal, table_alias) ⇒ Literal

Returns a new instance of Literal.



116
117
118
119
120
# File 'lib/params_ready/helpers/arel_builder.rb', line 116

def initialize(literal, table_alias)
  super literal
  raise "Table alias must be present" if table_alias.nil?
  @table_alias = table_alias.to_s.freeze
end

Instance Method Details

#to_arelObject



122
123
124
# File 'lib/params_ready/helpers/arel_builder.rb', line 122

def to_arel(*)
  Arel::Table.new(@literal).as(@table_alias)
end