Class: Arel::Visitors::ToSql

Inherits:
Reduce
  • Object
show all
Defined in:
lib/thredded/rails_lt_5_2_arel_case_node.rb

Instance Method Summary collapse

Instance Method Details

#visit_Arel_Nodes_Case(o, collector) ⇒ Object

rubocop:disable Naming/MethodName


89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/thredded/rails_lt_5_2_arel_case_node.rb', line 89

def visit_Arel_Nodes_Case(o, collector) # rubocop:disable Naming/MethodName
  collector << 'CASE '
  if o.case
    visit o.case, collector
    collector << ' '
  end
  o.conditions.each do |condition|
    visit condition, collector
    collector << ' '
  end
  if o.default
    visit o.default, collector
    collector << ' '
  end
  collector << 'END'
end

#visit_Arel_Nodes_Else(o, collector) ⇒ Object

rubocop:disable Naming/MethodName


113
114
115
116
# File 'lib/thredded/rails_lt_5_2_arel_case_node.rb', line 113

def visit_Arel_Nodes_Else(o, collector) # rubocop:disable Naming/MethodName
  collector << 'ELSE '
  visit o.expr, collector
end

#visit_Arel_Nodes_When(o, collector) ⇒ Object

rubocop:disable Naming/MethodName


106
107
108
109
110
111
# File 'lib/thredded/rails_lt_5_2_arel_case_node.rb', line 106

def visit_Arel_Nodes_When(o, collector) # rubocop:disable Naming/MethodName
  collector << 'WHEN '
  visit o.left, collector
  collector << ' THEN '
  visit o.right, collector
end