class ParamsReady::Helpers::ArelBuilder::Literal

Public Class Methods

new(literal, arel_table) click to toggle source
# File lib/params_ready/helpers/arel_builder.rb, line 42
def initialize(literal, arel_table)
  @literal = literal.to_s
  @arel_table = arel_table
end

Public Instance Methods

to_arel(default_table, _, _) click to toggle source
# File lib/params_ready/helpers/arel_builder.rb, line 47
def to_arel(default_table, _, _)
  arel_table = @arel_table || default_table
  if arel_table == :none
    Arel::Nodes::SqlLiteral.new(@literal)
  else
    arel_table[@literal]
  end
end