Class: Shelley::NonInteractiveShell
- Inherits:
-
Object
- Object
- Shelley::NonInteractiveShell
- Defined in:
- lib/shelley/shells.rb
Overview
A non-interactive shell. Executes given commands sequentially
Instance Method Summary collapse
-
#initialize(command_registry, commands) ⇒ NonInteractiveShell
constructor
A new instance of NonInteractiveShell.
-
#start ⇒ Object
Starts the shell.
Constructor Details
#initialize(command_registry, commands) ⇒ NonInteractiveShell
Returns a new instance of NonInteractiveShell.
45 46 47 48 |
# File 'lib/shelley/shells.rb', line 45 def initialize(command_registry, commands) @command_registry = command_registry @commands = commands end |
Instance Method Details
#start ⇒ Object
Starts the shell
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/shelley/shells.rb', line 51 def start @commands.each do |command| begin puts "> #{command}" @command_registry.execute_command(command) rescue StandardError => msg puts msg end end end |