class Arel::UpdateManager - arel-4.0.2 Documentation

# class Arel::UpdateManager

### Public Class Methods

new(engine) click to toggle source
Calls superclass method Arel::TreeManager.new

    # File lib/arel/update_manager.rb, line 3
    def initialize engine
      super
      @ast = Nodes::UpdateStatement.new
      @ctx = @ast
    end

### Public Instance Methods

key() click to toggle source

    # File lib/arel/update_manager.rb, line 18
    def key
      @ast.key
    end

key=(key) click to toggle source

    # File lib/arel/update_manager.rb, line 14
    def key= key
      @ast.key = key
    end

order(*expr) click to toggle source

    # File lib/arel/update_manager.rb, line 22
    def order *expr
      @ast.orders = expr
      self
    end

set(values) click to toggle source

    # 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) click to toggle source

UPDATE `table`

    # File lib/arel/update_manager.rb, line 29
    def table table
      @ast.relation = table
      self
    end

take(limit) click to toggle source

    # File lib/arel/update_manager.rb, line 9
    def take limit
      @ast.limit = Nodes::Limit.new(limit) if limit
      self
    end

where(expr) click to toggle source

    # File lib/arel/update_manager.rb, line 38
    def where expr
      @ast.wheres << expr
      self
    end

wheres=(exprs) click to toggle source

    # File lib/arel/update_manager.rb, line 34
    def wheres= exprs
      @ast.wheres = exprs
    end