Class: DB::Model::Statement::Truncate
- Inherits:
-
Object
- Object
- DB::Model::Statement::Truncate
- Defined in:
- lib/db/model/statement/truncate.rb
Instance Method Summary collapse
- #call(context) ⇒ Object
-
#initialize(source) ⇒ Truncate
constructor
A new instance of Truncate.
- #to_sql(context) ⇒ Object
Constructor Details
#initialize(source) ⇒ Truncate
Returns a new instance of Truncate.
27 28 29 |
# File 'lib/db/model/statement/truncate.rb', line 27 def initialize(source) @source = source end |
Instance Method Details
#call(context) ⇒ Object
39 40 41 |
# File 'lib/db/model/statement/truncate.rb', line 39 def call(context) to_sql(context).call end |
#to_sql(context) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/db/model/statement/truncate.rb', line 31 def to_sql(context) statement = context.clause("TRUNCATE TABLE") statement.identifier(@source.type) return statement end |