Module: Arel::FactoryMethods

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

Overview

Methods for creating various nodes

Instance Method Summary collapse

Instance Method Details

#create_and(clauses) ⇒ Object



25
26
27
# File 'lib/arel/factory_methods.rb', line 25

def create_and clauses
  Nodes::And.new clauses
end

#create_falseObject



9
10
11
# File 'lib/arel/factory_methods.rb', line 9

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

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



17
18
19
# File 'lib/arel/factory_methods.rb', line 17

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

#create_on(expr) ⇒ Object



29
30
31
# File 'lib/arel/factory_methods.rb', line 29

def create_on expr
  Nodes::On.new expr
end

#create_string_join(to) ⇒ Object



21
22
23
# File 'lib/arel/factory_methods.rb', line 21

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

#create_table_alias(relation, name) ⇒ Object



13
14
15
# File 'lib/arel/factory_methods.rb', line 13

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

#create_trueObject



5
6
7
# File 'lib/arel/factory_methods.rb', line 5

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

#grouping(expr) ⇒ Object



33
34
35
# File 'lib/arel/factory_methods.rb', line 33

def grouping expr
  Nodes::Grouping.new expr
end

#lower(column) ⇒ Object

Create a LOWER() function



39
40
41
# File 'lib/arel/factory_methods.rb', line 39

def lower column
  Nodes::NamedFunction.new 'LOWER', [column]
end