Class: Arel::UpdateManager
- Inherits:
-
TreeManager
- Object
- TreeManager
- Arel::UpdateManager
- Includes:
- TreeManager::StatementMethods
- Defined in:
- lib/arel/update_manager.rb
Instance Attribute Summary
Attributes inherited from TreeManager
Instance Method Summary collapse
-
#initialize ⇒ UpdateManager
constructor
A new instance of UpdateManager.
- #set(values) ⇒ Object
-
#table(table) ⇒ Object
UPDATE
table
.
Methods included from TreeManager::StatementMethods
#key, #key=, #offset, #order, #take, #where, #wheres=
Methods inherited from TreeManager
#initialize_copy, #to_dot, #to_sql, #where
Methods included from FactoryMethods
#coalesce, #create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower
Constructor Details
#initialize ⇒ UpdateManager
Returns a new instance of UpdateManager.
7 8 9 10 11 |
# File 'lib/arel/update_manager.rb', line 7 def initialize super @ast = Nodes::UpdateStatement.new @ctx = @ast end |
Instance Method Details
#set(values) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/arel/update_manager.rb', line 20 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
UPDATE table
15 16 17 18 |
# File 'lib/arel/update_manager.rb', line 15 def table(table) @ast.relation = table self end |