Class: Arel::UpdateManager
Instance Attribute Summary
Attributes inherited from TreeManager
#ast, #engine
Instance Method Summary
collapse
Methods inherited from TreeManager
#initialize_copy, #to_dot, #to_sql, #visitor
#create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower
Constructor Details
Returns a new instance of UpdateManager.
3
4
5
6
7
|
# File 'lib/arel/update_manager.rb', line 3
def initialize engine
super
@ast = Nodes::UpdateStatement.new
@ctx = @ast
end
|
Instance Method Details
#key ⇒ Object
18
19
20
|
# File 'lib/arel/update_manager.rb', line 18
def key
@ast.key
end
|
#key=(key) ⇒ Object
14
15
16
|
# File 'lib/arel/update_manager.rb', line 14
def key= key
@ast.key = key
end
|
#order(*expr) ⇒ Object
22
23
24
25
|
# File 'lib/arel/update_manager.rb', line 22
def order *expr
@ast.orders = expr
self
end
|
#set(values) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/arel/update_manager.rb', line 43
def set values
if String === values
@ast.values = [values]
else
@ast.values = values.map { |column,value|
Nodes::Assignment.new(
Nodes::UnqualifiedColumn.new(column),
value
)
}
end
self
end
|
#table(table) ⇒ Object
29
30
31
32
|
# File 'lib/arel/update_manager.rb', line 29
def table table
@ast.relation = table
self
end
|
#take(limit) ⇒ Object
9
10
11
12
|
# File 'lib/arel/update_manager.rb', line 9
def take limit
@ast.limit = Nodes::Limit.new(limit) if limit
self
end
|
#where(expr) ⇒ Object
38
39
40
41
|
# File 'lib/arel/update_manager.rb', line 38
def where expr
@ast.wheres << expr
self
end
|
#wheres=(exprs) ⇒ Object
34
35
36
|
# File 'lib/arel/update_manager.rb', line 34
def wheres= exprs
@ast.wheres = exprs
end
|