Class: Loops::Command
- Inherits:
-
Object
- Object
- Loops::Command
- Defined in:
- lib/loops/command.rb
Overview
Represents a Loops command.
Direct Known Subclasses
Loops::Commands::DebugCommand, Loops::Commands::ListCommand, Loops::Commands::StartCommand, Loops::Commands::StatsCommand, Loops::Commands::StopCommand
Instance Attribute Summary collapse
-
#engine ⇒ Engine
readonly
The instance of Engine to execute command in.
-
#options ⇒ Hash<String, Object>
readonly
The hash of (parsed) command-line options.
Instance Method Summary collapse
-
#execute ⇒ Object
A command entry point.
-
#initialize ⇒ Command
constructor
Initializes a new Command instance.
-
#invoke(engine, options) ⇒ Object
Invoke a command.
-
#requires_bootstrap? ⇒ Boolean
Gets a value indicating whether command needs to bootstrap framework.
Constructor Details
#initialize ⇒ Command
Initializes a new Loops::Command instance.
12 13 |
# File 'lib/loops/command.rb', line 12 def initialize end |
Instance Attribute Details
#engine ⇒ Engine (readonly)
Returns The instance of Engine to execute command in.
5 6 7 |
# File 'lib/loops/command.rb', line 5 def engine @engine end |
#options ⇒ Hash<String, Object> (readonly)
Returns The hash of (parsed) command-line options.
9 10 11 |
# File 'lib/loops/command.rb', line 9 def @options end |
Instance Method Details
#execute ⇒ Object
A command entry point. Should be overridden in descendants.
29 30 31 |
# File 'lib/loops/command.rb', line 29 def execute raise 'Generic command has no actions' end |
#invoke(engine, options) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/loops/command.rb', line 20 def invoke(engine, ) @engine = engine @options = execute end |
#requires_bootstrap? ⇒ Boolean
Gets a value indicating whether command needs to bootstrap framework.
34 35 36 |
# File 'lib/loops/command.rb', line 34 def requires_bootstrap? true end |