Class: Bogo::Cli::Command
- Inherits:
-
Object
- Object
- Bogo::Cli::Command
- Defined in:
- lib/bogo-cli/command.rb
Overview
Abstract command class
Instance Attribute Summary collapse
-
#arguments ⇒ Array
readonly
Cli arguments.
-
#options ⇒ Hash
readonly
Options.
- #ui ⇒ Ui readonly
Instance Method Summary collapse
-
#execute! ⇒ TrueClass
Execute the command.
-
#initialize(opts, args) ⇒ self
constructor
Build new command instance.
Constructor Details
#initialize(opts, args) ⇒ self
Build new command instance
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bogo-cli/command.rb', line 20 def initialize(opts, args) = opts.to_smash @arguments = args @ui = Ui.new( opts.fetch( :app_name, self.class.name.split('::').first ) ) load_config! end |
Instance Attribute Details
#arguments ⇒ Array (readonly)
13 14 15 |
# File 'lib/bogo-cli/command.rb', line 13 def arguments @arguments end |
#options ⇒ Hash (readonly)
11 12 13 |
# File 'lib/bogo-cli/command.rb', line 11 def end |
#ui ⇒ Ui (readonly)
15 16 17 |
# File 'lib/bogo-cli/command.rb', line 15 def ui @ui end |
Instance Method Details
#execute! ⇒ TrueClass
Execute the command
35 36 37 |
# File 'lib/bogo-cli/command.rb', line 35 def execute! raise NotImplementedError end |