1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/arel/delete_manager.rb

33 lines
657 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-02-24 01:45:50 -05:00
2018-02-24 02:41:47 -05:00
module Arel # :nodoc: all
2010-08-18 14:32:44 -04:00
class DeleteManager < Arel::TreeManager
include TreeManager::StatementMethods
def initialize(table = nil)
@ast = Nodes::DeleteStatement.new(table)
2010-08-18 14:32:44 -04:00
end
2018-02-24 01:45:50 -05:00
def from(relation)
2010-11-05 17:09:09 -04:00
@ast.relation = relation
2010-08-18 14:32:44 -04:00
self
end
def group(columns)
columns.each do |column|
column = Nodes::SqlLiteral.new(column) if String === column
column = Nodes::SqlLiteral.new(column.to_s) if Symbol === column
@ast.groups.push Nodes::Group.new column
end
self
end
def having(expr)
@ast.havings << expr
self
end
2010-08-18 14:32:44 -04:00
end
end