Class: Delete

Inherits:
SqlStatement show all
Defined in:
lib/delete.rb

Instance Attribute Summary

Attributes inherited from SqlStatement

#tables, #to_sql

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SqlStatement

#and, #and_with_or_conditions, #initialize, #or, #where

Constructor Details

This class inherits a constructor from SqlStatement

Class Method Details

.fromObject

call-seq: Delete.from -> a_delete

Returns a Delete instance with the SQL initialized to ‘delete from ’

Delete.from.to_sql       #=> "delete from "


8
9
10
# File 'lib/delete.rb', line 8

def from      
  self.new('delete from ')
end

Instance Method Details

#[](table) ⇒ Object

call-seq: delete -> a_delete

Returns a Delete instance with the table appended to the SQL statement.

Delete.from[:table1].to_sql       #=> "delete from table1"


18
19
20
21
22
# File 'lib/delete.rb', line 18

def [](table)
  @to_sql += table.to_sql
  @tables = [table]
  self
end