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



27
28
29
30
31
# File 'lib/torque/postgresql/arel/visitors.rb', line 27

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

#visit_Arel_Nodes_JoinSource(o, collector) ⇒ Object

Add ONLY modifier to query



15
16
17
18
# 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) ⇒ Object

Allow quoted arrays to get here



21
22
23
24
# 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) ⇒ Object

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



9
10
11
12
# 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) ⇒ Object

TORQUE VISITORS Allow casting any node



35
36
37
# 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