Class: Rbsh::Shell
- Inherits:
- BasicObject
- Defined in:
- lib/rbsh/shell.rb
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#initialize ⇒ Shell
constructor
A new instance of Shell.
- #load_script!(script) ⇒ Object
- #method_missing(name, *args, &block) ⇒ Object
- #run! ⇒ Object
Constructor Details
#initialize ⇒ Shell
Returns a new instance of Shell.
4 5 6 |
# File 'lib/rbsh/shell.rb', line 4 def initialize @_result = Result.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rbsh/shell.rb', line 13 def method_missing(name, *args, &block) if @_pipeline @_result.append(@_pipeline.run!) end @_pipeline = ::Rbsh::Pipeline.new(name, *args) @_pipeline end |
Instance Method Details
#load_script!(script) ⇒ Object
21 22 23 24 |
# File 'lib/rbsh/shell.rb', line 21 def load_script!(script) instance_eval(script) self end |
#run! ⇒ Object
8 9 10 11 |
# File 'lib/rbsh/shell.rb', line 8 def run! @_result.append(@_pipeline.run!) @_result end |