Class: Yap::Shell::Evaluation
- Inherits:
-
Object
- Object
- Yap::Shell::Evaluation
- Defined in:
- lib/yap/shell/evaluation.rb,
lib/yap/shell/evaluation/shell_expansions.rb
Defined Under Namespace
Classes: ShellExpansions
Instance Attribute Summary collapse
-
#world ⇒ Object
readonly
Returns the value of attribute world.
Instance Method Summary collapse
- #evaluate(input, &blk) ⇒ Object
-
#initialize(stdin:, stdout:, stderr:, world:) ⇒ Evaluation
constructor
A new instance of Evaluation.
- #set_last_result(result) ⇒ Object
Constructor Details
#initialize(stdin:, stdout:, stderr:, world:) ⇒ Evaluation
Returns a new instance of Evaluation.
10 11 12 13 |
# File 'lib/yap/shell/evaluation.rb', line 10 def initialize(stdin:, stdout:, stderr:, world:) @stdin, @stdout, @stderr = stdin, stdout, stderr @world = world end |
Instance Attribute Details
#world ⇒ Object (readonly)
Returns the value of attribute world.
8 9 10 |
# File 'lib/yap/shell/evaluation.rb', line 8 def world @world end |
Instance Method Details
#evaluate(input, &blk) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/yap/shell/evaluation.rb', line 15 def evaluate(input, &blk) @blk = blk debug_log "evaluation begins input=#{input.inspect}" @input = recursively_find_and_replace_command_substitutions(input) debug_log "recursive find/replace command substitutions results in input=#{@input.inspect}" ast = Parser.parse(@input) debug_log "parsed input into AST: #{ast}" debug_log "beginning to walk AST" ast.accept(self).tap do debug_log "done walking AST" end end |
#set_last_result(result) ⇒ Object
28 29 30 31 |
# File 'lib/yap/shell/evaluation.rb', line 28 def set_last_result(result) debug_log "evaluation setting last result=#{result.inspect}" @world.last_result = result end |