Class: Ardb::CLI::DropCommand
- Inherits:
-
Object
- Object
- Ardb::CLI::DropCommand
- Defined in:
- lib/ardb/cli.rb,
lib/ardb/cli.rb
Instance Attribute Summary collapse
-
#clirb ⇒ Object
readonly
Returns the value of attribute clirb.
Instance Method Summary collapse
- #help ⇒ Object
-
#initialize(argv, stdout = nil, stderr = nil) ⇒ DropCommand
constructor
A new instance of DropCommand.
- #run ⇒ Object
Constructor Details
#initialize(argv, stdout = nil, stderr = nil) ⇒ DropCommand
Returns a new instance of DropCommand.
171 172 173 174 175 176 177 178 |
# File 'lib/ardb/cli.rb', line 171 def initialize(argv, stdout = nil, stderr = nil) @argv = argv @stdout = stdout || $stdout @stderr = stderr || $stderr @clirb = Ardb::CLIRB.new @adapter = Ardb::Adapter.send(Ardb.config.db.adapter) end |
Instance Attribute Details
#clirb ⇒ Object (readonly)
Returns the value of attribute clirb.
169 170 171 |
# File 'lib/ardb/cli.rb', line 169 def clirb @clirb end |
Instance Method Details
#help ⇒ Object
192 193 194 195 |
# File 'lib/ardb/cli.rb', line 192 def help "Usage: ardb drop [options]\n\n" \ "Options: #{@clirb}" end |
#run ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/ardb/cli.rb', line 180 def run @clirb.parse!(@argv) begin @adapter.drop_db @stdout.puts "dropped #{Ardb.config.db.adapter} db `#{Ardb.config.db.database}`" rescue StandardError => e @stderr.puts e @stderr.puts "error dropping #{Ardb.config.db.database.inspect} database" raise CommandExitError end end |