Class: Askcii::Commands::BaseCommand
- Inherits:
-
Object
- Object
- Askcii::Commands::BaseCommand
- Defined in:
- lib/askcii/commands/base_command.rb
Overview
Base class for all command implementations
Direct Known Subclasses
ChatCommand, ClearHistoryCommand, ConfigureCommand, HelpCommand, HistoryCommand, LastResponseCommand, ListSessionsCommand
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#execute ⇒ void
Executes the command.
-
#initialize(cli, config = nil) ⇒ BaseCommand
constructor
A new instance of BaseCommand.
Constructor Details
#initialize(cli, config = nil) ⇒ BaseCommand
Returns a new instance of BaseCommand.
11 12 13 14 |
# File 'lib/askcii/commands/base_command.rb', line 11 def initialize(cli, config = nil) @cli = cli @config = config end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
7 8 9 |
# File 'lib/askcii/commands/base_command.rb', line 7 def cli @cli end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/askcii/commands/base_command.rb', line 7 def config @config end |
Instance Method Details
#execute ⇒ void
This method returns an undefined value.
Executes the command
18 19 20 |
# File 'lib/askcii/commands/base_command.rb', line 18 def execute raise NotImplementedError, "#{self.class} must implement #execute" end |