class IRuby::PryBackend
Public Class Methods
new()
click to toggle source
# File lib/iruby/backend.rb, line 55 def initialize require 'pry' Pry.memory_size = 3 Pry.pager = false # Don't use the pager Pry.print = proc {|output, value|} # No result printing Pry.exception_handler = proc {|output, exception, _| } reset end
Public Instance Methods
complete(code)
click to toggle source
# File lib/iruby/backend.rb, line 80 def complete(code) @pry.complete(code) end
eval(code, store_history)
click to toggle source
# File lib/iruby/backend.rb, line 64 def eval(code, store_history) @pry.last_result = nil unless @pry.eval(code) reset raise SystemExit end unless @pry.eval_string.empty? syntax_error = @pry.eval_string @pry.reset_eval_string @pry.evaluate_ruby syntax_error end raise @pry.last_exception if @pry.last_result_is_exception? @pry.push_initial_binding unless @pry.current_binding # ensure that we have a binding @pry.last_result end
reset()
click to toggle source
# File lib/iruby/backend.rb, line 84 def reset @pry = Pry.new(output: $stdout, target: TOPLEVEL_BINDING) end