Class: Ardb::Runner::DropCommand
- Inherits:
-
Object
- Object
- Ardb::Runner::DropCommand
- Defined in:
- lib/ardb/runner/drop_command.rb
Instance Method Summary collapse
-
#initialize(out_io = nil, err_io = nil) ⇒ DropCommand
constructor
A new instance of DropCommand.
- #run ⇒ Object
Constructor Details
#initialize(out_io = nil, err_io = nil) ⇒ DropCommand
Returns a new instance of DropCommand.
6 7 8 9 10 |
# File 'lib/ardb/runner/drop_command.rb', line 6 def initialize(out_io = nil, err_io = nil) @out_io = out_io || $stdout @err_io = err_io || $stderr @adapter = Ardb::Adapter.send(Ardb.config.db.adapter) end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ardb/runner/drop_command.rb', line 12 def run begin @adapter.drop_db @out_io.puts "dropped #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`" rescue Ardb::Runner::CmdError => e raise e rescue StandardError => e @err_io.puts e @err_io.puts "error dropping #{Ardb.config.db.database.inspect} database" raise Ardb::Runner::CmdFail end end |