Class: WebConsole::REPL::Dummy
- Inherits:
-
Object
- Object
- WebConsole::REPL::Dummy
- Defined in:
- lib/web_console/repl/dummy.rb
Overview
Dummy\ Adapter
Dummy adapter that is used as a fallback for REPL with no adapters.
It provides only the most basic code evaluation with no multiline code support.
Instance Method Summary collapse
-
#initialize(binding = TOPLEVEL_BINDING) ⇒ Dummy
constructor
A new instance of Dummy.
- #prompt ⇒ Object
- #send_input(input) ⇒ Object
Constructor Details
#initialize(binding = TOPLEVEL_BINDING) ⇒ Dummy
Returns a new instance of Dummy.
12 13 14 |
# File 'lib/web_console/repl/dummy.rb', line 12 def initialize(binding = TOPLEVEL_BINDING) @binding = binding end |
Instance Method Details
#prompt ⇒ Object
16 17 18 |
# File 'lib/web_console/repl/dummy.rb', line 16 def prompt '>> ' end |
#send_input(input) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/web_console/repl/dummy.rb', line 20 def send_input(input) eval_result = nil streams_output = Stream.threadsafe_capture! do eval_result = @binding.eval(input).inspect end "#{streams_output}=> #{eval_result}\n" rescue Exception => exc exc.backtrace.join("\n") end |