module Torque::PostgreSQL::Arel::Visitors

Public Instance Methods

visit_Arel_Nodes_Casted(o, collector) click to toggle source

Allow quoted arrays to get here

Calls superclass method
# File lib/torque/postgresql/arel/visitors.rb, line 27
def visit_Arel_Nodes_Casted(o, collector)
  value = o.respond_to?(:val) ? o.val : o.value
  return super unless value.is_a?(::Enumerable)
  quote_array(value, collector)
end
visit_Arel_Nodes_JoinSource(o, collector) click to toggle source

Add ONLY modifier to query

Calls superclass method
# File lib/torque/postgresql/arel/visitors.rb, line 15
def visit_Arel_Nodes_JoinSource(o, collector)
  collector << 'ONLY ' if o.only?
  super
end
visit_Arel_Nodes_Quoted(o, collector) click to toggle source

Allow quoted arrays to get here

Calls superclass method
# File lib/torque/postgresql/arel/visitors.rb, line 21
def visit_Arel_Nodes_Quoted(o, collector)
  return super unless o.expr.is_a?(::Enumerable)
  quote_array(o.expr, collector)
end
visit_Arel_SelectManager(o, collector) click to toggle source

Enclose select manager with parenthesis :todo: Remove when checking the new version of Arel

# File lib/torque/postgresql/arel/visitors.rb, line 9
def visit_Arel_SelectManager(o, collector)
  collector << '('
  visit(o.ast, collector) << ')'
end
visit_Torque_PostgreSQL_Arel_Nodes_Cast(o, collector) click to toggle source
TORQUE VISITORS

Allow casting any node

# File lib/torque/postgresql/arel/visitors.rb, line 35
def visit_Torque_PostgreSQL_Arel_Nodes_Cast(o, collector)
  visit(o.left, collector) << '::' << o.right
end

Private Instance Methods

quote_array(value, collector) click to toggle source
# File lib/torque/postgresql/arel/visitors.rb, line 41
def quote_array(value, collector)
  value = value.map(&::Arel::Nodes.method(:build_quoted))

  collector << 'ARRAY['
  visit_Array(value, collector)
  collector << ']'
end