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.
10 11 12 |
# File 'lib/db/model/statement/truncate.rb', line 10 def initialize(source) @source = source end |
Instance Method Details
#call(context) ⇒ Object
22 23 24 |
# File 'lib/db/model/statement/truncate.rb', line 22 def call(context) to_sql(context).call end |
#to_sql(context) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/db/model/statement/truncate.rb', line 14 def to_sql(context) statement = context.clause("TRUNCATE TABLE") statement.identifier(@source.type) return statement end |