Class: Alphonse::Cli
- Inherits:
-
Object
- Object
- Alphonse::Cli
- Defined in:
- lib/alphonse/cli.rb
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#config ⇒ Object
Returns the value of attribute config.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(argv = []) ⇒ Cli
constructor
A new instance of Cli.
Constructor Details
#initialize(argv = []) ⇒ Cli
Returns a new instance of Cli.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/alphonse/cli.rb', line 16 def initialize(argv = []) @argv = argv @options = { :environment => :production } @command = option_parser.parse!(@argv).delete_at(0) if @command @command = @command.to_sym else raise CliArgumentError, "An operation is required" end end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
7 8 9 |
# File 'lib/alphonse/cli.rb', line 7 def argv @argv end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
7 8 9 |
# File 'lib/alphonse/cli.rb', line 7 def command @command end |
#config ⇒ Object
Returns the value of attribute config.
8 9 10 |
# File 'lib/alphonse/cli.rb', line 8 def config @config end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/alphonse/cli.rb', line 7 def @options end |
Class Method Details
.start(argv = ARGV) ⇒ Object
10 11 12 13 14 |
# File 'lib/alphonse/cli.rb', line 10 def self.start(argv = ARGV) cli = self.new(argv) cli.execute cli end |