Class: WebConsole::REPL
- Inherits:
-
Object
- Object
- WebConsole::REPL
- Defined in:
- lib/web_console/repl.rb
Overview
Simple read–eval–print implementation.
Provides only the most basic code evaluation with no multiline code support.
Constant Summary collapse
- @@cleaner =
ActiveSupport::BacktraceCleaner.new
Instance Method Summary collapse
-
#initialize(binding = TOPLEVEL_BINDING) ⇒ REPL
constructor
A new instance of REPL.
- #prompt ⇒ Object
- #send_input(input) ⇒ Object
Constructor Details
#initialize(binding = TOPLEVEL_BINDING) ⇒ REPL
Returns a new instance of REPL.
12 13 14 |
# File 'lib/web_console/repl.rb', line 12 def initialize(binding = TOPLEVEL_BINDING) @binding = binding end |
Instance Method Details
#prompt ⇒ Object
16 17 18 |
# File 'lib/web_console/repl.rb', line 16 def prompt '>> ' end |
#send_input(input) ⇒ Object
20 21 22 23 24 |
# File 'lib/web_console/repl.rb', line 20 def send_input(input) "=> #{@binding.eval(input).inspect}\n" rescue Exception => exc format_exception(exc) end |