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



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

def create_and clauses
  Nodes::And.new clauses
end

#create_falseObject



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

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

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



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

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

#create_on(expr) ⇒ Object



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

def create_on expr
  Nodes::On.new expr
end

#create_string_join(to) ⇒ Object



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

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

#create_table_alias(relation, name) ⇒ Object



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

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

#create_trueObject



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

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

#grouping(expr) ⇒ Object



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

def grouping expr
  Nodes::Grouping.new expr
end

#lower(column) ⇒ Object

Create a LOWER() function



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

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