Class: Epi::Cli::Command
- Inherits:
-
Object
- Object
- Epi::Cli::Command
- Defined in:
- lib/epi/cli/command.rb
Direct Known Subclasses
Epi::Cli::Commands::Config, Epi::Cli::Commands::Daemon, Epi::Cli::Commands::Job, Epi::Cli::Commands::Restart, Epi::Cli::Commands::Start, Epi::Cli::Commands::Status, Epi::Cli::Commands::Stop
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Command
constructor
A new instance of Command.
- #need_root! ⇒ Object
Constructor Details
#initialize(args) ⇒ Command
Returns a new instance of Command.
18 19 20 |
# File 'lib/epi/cli/command.rb', line 18 def initialize(args) @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
16 17 18 |
# File 'lib/epi/cli/command.rb', line 16 def args @args end |
Class Method Details
.run(command, args) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/epi/cli/command.rb', line 7 def self.run(command, args) const_name = command.camelize.to_sym if Commands.const_defined? const_name klass = Commands.const_get const_name return klass.new(args).run if Class === klass && klass < self end raise Exceptions::Fatal, 'Unknown command' end |