require 'pry' unless defined? Pry require 'pry-moves/tracer' class << Pry alias_method :start_without_pry_nav, :start def start_with_pry_nav(target = TOPLEVEL_BINDING, options = {}) old_options = options.reject { |k, _| k == :pry_remote } if target.is_a?(Binding) && PryMoves.check_file_context(target) # Wrap the tracer around the usual Pry.start PryMoves::Tracer.new(options).run do start_without_pry_nav(target, old_options) end else # No need for the tracer unless we have a file context to step through start_without_pry_nav(target, old_options) end end alias_method :start, :start_with_pry_nav end Binding.class_eval do alias original_pry pry def pry original_pry unless Pry.config.disable_breakpoints end end require 'pry-stack_explorer' PryStackExplorer::WhenStartedHook.class_eval do def remove_debugger_frames(bindings) bindings.drop_while { |b| b.eval("__FILE__") =~ /\/pry-/ } end end