class Qdsl::Expression

Public Instance Methods

and(expr) click to toggle source
# File lib/expression.rb, line 3
def and(expr)
  And.new([self, expr])
end
or(expr) click to toggle source
# File lib/expression.rb, line 7
def or(expr)
  Or.new([self, expr])
end

Protected Instance Methods

render_operand(context, ids, operand) click to toggle source
# File lib/expression.rb, line 13
def render_operand(context, ids, operand)
  if operand.is_a?(String)
    parameter_id = context.create_parameter_id
    SimpleRenderResult.new(":#{parameter_id}", {parameter_id => operand})
  elsif operand.is_a?(TrueClass)
    SimpleRenderResult.new('TRUE', {})
  elsif operand.is_a?(FalseClass)
    SimpleRenderResult.new('FALSE', {})
  elsif operand.is_a?(Expression)
    operand.render_sql(context, ids)
  else
    operand.render_sql(context, ids[operand.source])
  end
end