Sha256: 322b6376dd897b85fd52f67f2e715d5bf863d314097c0900c70f69cc39fb6102

Contents?: true

Size: 989 Bytes

Versions: 2

Compression:

Stored size: 989 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pry-moves-0.1.1 lib/pry-moves/pry_ext.rb
pry-moves-0.1.0 lib/pry-moves/pry_ext.rb