Class: Rexpl::Environment
- Inherits:
-
Object
- Object
- Rexpl::Environment
- Defined in:
- lib/rexpl/environment.rb
Overview
This class represents the Environment holding a GeneratorProxy instance exposing the main entry point as a class method.
Constant Summary collapse
- @@generator =
GeneratorProxy.new
Class Method Summary collapse
-
.run ⇒ Object
Fires up the REPL.
Class Method Details
.run ⇒ Object
Fires up the REPL. This is the program’s main entry point.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rexpl/environment.rb', line 10 def run Output. while (Output.print_prompt; input = gets) @@generator.instance_eval input.chomp # After each new instruction, evaluate all of them. dynamic_method(:run) do |g| @@generator.visit(g) if g.size == 0 g.push_nil else g.print_debug_info end g.ret end new.run end end |