Module: Torque::PostgreSQL::Arel::Visitors

Defined in:
lib/torque/postgresql/arel/visitors.rb

Instance Method Summary collapse

Instance Method Details

#visit_Arel_Nodes_Casted(o, collector) ⇒ Object

Allow quoted arrays to get here



25
26
27
28
# File 'lib/torque/postgresql/arel/visitors.rb', line 25

def visit_Arel_Nodes_Casted(o, collector)
  return super unless o.val.is_a?(::Enumerable)
  quote_array(o.val, collector)
end

#visit_Arel_Nodes_JoinSource(o, collector) ⇒ Object

Add ONLY modifier to query



13
14
15
16
# File 'lib/torque/postgresql/arel/visitors.rb', line 13

def visit_Arel_Nodes_JoinSource(o, collector)
  collector << 'ONLY ' if o.only?
  super
end

#visit_Arel_Nodes_Quoted(o, collector) ⇒ Object

Allow quoted arrays to get here



19
20
21
22
# File 'lib/torque/postgresql/arel/visitors.rb', line 19

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) ⇒ Object

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



7
8
9
10
# File 'lib/torque/postgresql/arel/visitors.rb', line 7

def visit_Arel_SelectManager o, collector
  collector << '('
  visit(o.ast, collector) << ')'
end

#visit_Torque_PostgreSQL_Arel_Nodes_Cast(o, collector) ⇒ Object

TORQUE VISITORS Allow casting any node



32
33
34
# File 'lib/torque/postgresql/arel/visitors.rb', line 32

def visit_Torque_PostgreSQL_Arel_Nodes_Cast(o, collector)
  visit(o.left, collector) << '::' << o.right
end