Class: WebConsole::REPL::Pry
- Inherits:
-
Object
- Object
- WebConsole::REPL::Pry
- Defined in:
- lib/web_console/repl/pry.rb,
lib/web_console/repl/pry/version.rb
Defined Under Namespace
Classes: FiberInput
Constant Summary collapse
- ENFORCED_UNSUPPORTED_OPTIONS =
{ color: false, pager: false }
- VERSION =
"0.2.1"
Instance Method Summary collapse
-
#initialize(binding = ::Pry.toplevel_binding) ⇒ Pry
constructor
A new instance of Pry.
- #prompt ⇒ Object
- #send_input(input) ⇒ Object
Constructor Details
#initialize(binding = ::Pry.toplevel_binding) ⇒ Pry
Returns a new instance of Pry.
21 22 23 24 25 26 |
# File 'lib/web_console/repl/pry.rb', line 21 def initialize(binding = ::Pry.toplevel_binding) @binding = binding @input = FiberInput.new @pry = ::Pry.new(input: @input) @fiber = Fiber.new { { @pry.repl(binding) } }.tap(&:resume) end |
Instance Method Details
#prompt ⇒ Object
28 29 30 |
# File 'lib/web_console/repl/pry.rb', line 28 def prompt @pry.select_prompt(@input.previous, @binding) end |
#send_input(input) ⇒ Object
32 33 34 |
# File 'lib/web_console/repl/pry.rb', line 32 def send_input(input) Stream.threadsafe_capture! { @fiber.resume("#{input}\n") } end |