Module: Squidward::Command
- Defined in:
- lib/squidward.rb,
lib/squidward/commands/run.rb,
lib/squidward/commands/base.rb,
lib/squidward/commands/help.rb,
lib/squidward/commands/info.rb,
lib/squidward/commands/logs.rb,
lib/squidward/commands/bucket.rb,
lib/squidward/commands/domain.rb,
lib/squidward/commands/secured.rb,
lib/squidward/commands/version.rb,
lib/squidward/commands/credentials.rb
Overview
Commands container, if you can’t call this a command pattern implentation, there’s no such thing
Defined Under Namespace
Classes: Base, Bucket, Credentials, Domain, Help, Info, Logs, Run, Secured, Version
Class Method Summary collapse
-
.run!(command, args) ⇒ Object
Runs the given command and performs the proper invocation based on the user input.
Class Method Details
.run!(command, args) ⇒ Object
Runs the given command and performs the proper invocation based on the user input. This method is the core dispatcher for the whole application.
16 17 18 19 20 21 22 23 24 |
# File 'lib/squidward.rb', line 16 def run!(command, args) command, method = command.gsub(/-/,'_').split(/:/) klass, method = eval("Squidward::Command::#{command.capitalize}"), (method or :index).to_sym instance = klass.new instance.send(method, args) rescue puts("Unknown command. Run 'squidward help' for usage information.") end |