Module: Arel::FactoryMethods

Included in:
Nodes::Node, Table, TreeManager
Defined in:
activerecord/lib/arel/factory_methods.rb

Overview

Methods for creating various nodes

Instance Method Summary collapse

Instance Method Details

#coalesce(*exprs) ⇒ Object



45
46
47
# File 'activerecord/lib/arel/factory_methods.rb', line 45

def coalesce(*exprs)
  Nodes::NamedFunction.new "COALESCE", exprs
end

#create_and(clauses) ⇒ Object



27
28
29
# File 'activerecord/lib/arel/factory_methods.rb', line 27

def create_and(clauses)
  Nodes::And.new clauses
end

#create_falseObject



11
12
13
# File 'activerecord/lib/arel/factory_methods.rb', line 11

def create_false
  Arel::Nodes::False.new
end

#create_join(to, constraint = nil, klass = Nodes::InnerJoin) ⇒ Object



19
20
21
# File 'activerecord/lib/arel/factory_methods.rb', line 19

def create_join(to, constraint = nil, klass = Nodes::InnerJoin)
  klass.new(to, constraint)
end

#create_on(expr) ⇒ Object



31
32
33
# File 'activerecord/lib/arel/factory_methods.rb', line 31

def create_on(expr)
  Nodes::On.new expr
end

#create_string_join(to) ⇒ Object



23
24
25
# File 'activerecord/lib/arel/factory_methods.rb', line 23

def create_string_join(to)
  create_join to, nil, Nodes::StringJoin
end

#create_table_alias(relation, name) ⇒ Object



15
16
17
# File 'activerecord/lib/arel/factory_methods.rb', line 15

def create_table_alias(relation, name)
  Nodes::TableAlias.new(relation, name)
end

#create_trueObject



7
8
9
# File 'activerecord/lib/arel/factory_methods.rb', line 7

def create_true
  Arel::Nodes::True.new
end

#grouping(expr) ⇒ Object



35
36
37
# File 'activerecord/lib/arel/factory_methods.rb', line 35

def grouping(expr)
  Nodes::Grouping.new expr
end

#lower(column) ⇒ Object

Create a LOWER() function



41
42
43
# File 'activerecord/lib/arel/factory_methods.rb', line 41

def lower(column)
  Nodes::NamedFunction.new "LOWER", [Nodes.build_quoted(column)]
end