Class: Itiel::DB::Truncator
- Inherits:
-
Object
- Object
- Itiel::DB::Truncator
- Includes:
- SQLConnectable, Nameable
- Defined in:
- lib/itiel/db/truncator.rb
Overview
Instance Attribute Summary collapse
-
#tables ⇒ Object
Returns the value of attribute tables.
Attributes included from SQLConnectable
#connection, #connection_file_path
Attributes included from Nameable
Instance Method Summary collapse
-
#initialize(*tables) ⇒ Truncator
constructor
A new instance of Truncator.
- #truncate! ⇒ Object
Methods included from SQLConnectable
Constructor Details
#initialize(*tables) ⇒ Truncator
Returns a new instance of Truncator.
18 19 20 |
# File 'lib/itiel/db/truncator.rb', line 18 def initialize(*tables) self.tables = tables end |
Instance Attribute Details
#tables ⇒ Object
Returns the value of attribute tables.
16 17 18 |
# File 'lib/itiel/db/truncator.rb', line 16 def tables @tables end |
Instance Method Details
#truncate! ⇒ Object
22 23 24 25 26 27 |
# File 'lib/itiel/db/truncator.rb', line 22 def truncate! tables.each do |table| db = self.class.sequel_connection(connection) db[table.to_sym].truncate end end |