Class: Yap::Shell::Evaluation

Inherits:
Object
  • Object
show all
Defined in:
lib/yap/shell/evaluation.rb,
lib/yap/shell/evaluation/shell_expansions.rb

Defined Under Namespace

Classes: ShellExpansions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdin:, stdout:, stderr:, world:) ⇒ 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

#worldObject (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
# File 'lib/yap/shell/evaluation.rb', line 15

def evaluate(input, &blk)
  @blk = blk
  @input = recursively_find_and_replace_command_substitutions(input)
  ast = Parser.parse(@input)
  ast.accept(self)
end

#set_last_result(result) ⇒ Object



22
23
24
# File 'lib/yap/shell/evaluation.rb', line 22

def set_last_result(result)
  @world.last_result = result
end