class Pry::REPL

Public Instance Methods

repl() click to toggle source

To make the console more useful, we make it so we flush the event registry after each line. This makes it so events are triggered after each line. To accomplish this we monkey-patch pry.

# File lib/volt/cli/console.rb, line 8
def repl
  loop do
    case val = read
    when :control_c
      output.puts ''
      pry.reset_eval_string
    when :no_more_input
      output.puts '' if output.tty?
      break
    else
      output.puts '' if val.nil? && output.tty?
      return pry.exit_value unless pry.eval(val)
    end

    # Flush after each line
    Volt::Computation.flush!
    Volt::Timers.flush_next_tick_timers!
  end
end