Sha256: 0c4dca3ae71ee872229b5489f0047f38dd2daf346fb3f6ab0b815123dc2e2bc8
Contents?: true
Size: 1.96 KB
Versions: 3
Compression:
Stored size: 1.96 KB
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::PryWrapper.new(target, 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 pry_forced pry def pry unless Pry.config.disable_breakpoints PryMoves.synchronize_threads pry_forced end end end Pry.config.pager = false Pry::Command::Whereami.class_eval do # Negligent function from Pry - evidently poor output format # would be wanted to be changed often by developers, # but definition so long... :( def process if bad_option_combination? raise CommandError, "Only one of -m, -c, -f, and LINES may be specified." end if nothing_to_do? return elsif internal_binding?(target) handle_internal_binding return end set_file_and_dir_locals(@file) _pry_.pager.page build_output end def build_output lines = [] lines << "#{text.bold('From:')} #{location}" lines << PryMoves::Watch.instance.output(target) unless PryMoves::Watch.instance.empty? lines << '' lines << "#{code.with_line_numbers(use_line_numbers?).with_marker(marker).highlighted}" lines << '' lines.join "\n" end def location me = target.eval 'self' rescue nil if me colored_str = '' Pry::ColorPrinter.pp me, colored_str me = colored_str.chomp end file = defined?(Rails) ? @file.gsub(Rails.root.to_s, '') : @file "#{file}:#{@line} #{me}" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pry-moves-0.1.4 | lib/pry-moves/pry_ext.rb |
pry-moves-0.1.3 | lib/pry-moves/pry_ext.rb |
pry-moves-0.1.2 | lib/pry-moves/pry_ext.rb |