Class: Arel::Sql::WhereCondition

Inherits:
Formatter show all
Defined in:
lib/arel/engines/sql/formatters.rb

Direct Known Subclasses

Attribute, Value

Instance Attribute Summary

Attributes inherited from Formatter

#christener, #engine, #environment

Instance Method Summary collapse

Methods inherited from Formatter

#initialize, #name_for, #quote, #quote_column_name, #quote_table_name

Constructor Details

This class inherits a constructor from Arel::Sql::Formatter

Instance Method Details

#attribute(attribute) ⇒ Object



82
83
84
# File 'lib/arel/engines/sql/formatters.rb', line 82

def attribute(attribute)
  "#{quote_table_name(name_for(attribute.original_relation))}.#{quote_column_name(attribute.name)}"
end

#expression(expression) ⇒ Object



86
87
88
# File 'lib/arel/engines/sql/formatters.rb', line 86

def expression(expression)
  "#{expression.function_sql}(#{expression.attribute.to_sql(self)})"
end

#scalar(value, column = nil) ⇒ Object



94
95
96
# File 'lib/arel/engines/sql/formatters.rb', line 94

def scalar(value, column = nil)
  quote(value, column)
end

#select(select_sql, table) ⇒ Object



98
99
100
# File 'lib/arel/engines/sql/formatters.rb', line 98

def select(select_sql, table)
  "(#{select_sql})"
end

#value(value) ⇒ Object



90
91
92
# File 'lib/arel/engines/sql/formatters.rb', line 90

def value(value)
  value.to_sql(self)
end