Class: Chimps::CLI::Runner
- Includes:
- Chimps::Commands
- Defined in:
- lib/chimps/cli.rb
Overview
Defines methods to parse the original ARGV and from it choose and instantiate the appropriate Chimps::Command subclass with the appropriate arguments.
Constant Summary
Constants included from Chimps::Commands
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
The original ARGV passed in by the user.
Instance Method Summary collapse
-
#command ⇒ Chimps::Command
The chosen and initialized command for this Runner.
-
#execute! ⇒ Object
Execute this Runner’s chosen and initialized command.
-
#initialize(argv) ⇒ Chimps::CLI::Runner
constructor
Create a new Chimps::CLI::Runner from
argv.
Methods included from Chimps::Commands
#command_name?, #construct, construct
Constructor Details
#initialize(argv) ⇒ Chimps::CLI::Runner
Create a new Chimps::CLI::Runner from argv.
39 40 41 |
# File 'lib/chimps/cli.rb', line 39 def initialize argv @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
The original ARGV passed in by the user.
33 34 35 |
# File 'lib/chimps/cli.rb', line 33 def argv @argv end |
Instance Method Details
#command ⇒ Chimps::Command
The chosen and initialized command for this Runner.
51 52 53 |
# File 'lib/chimps/cli.rb', line 51 def command @command ||= construct(command_name, argv_for_command) end |
#execute! ⇒ Object
Execute this Runner’s chosen and initialized command.
44 45 46 |
# File 'lib/chimps/cli.rb', line 44 def execute! command.execute! end |