diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index aee5b0a6..68edb3e5 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -139,6 +139,7 @@ class Pry # Push a binding for the given object onto the stack. def push_binding(object) + @stopped = false binding_stack << Pry.binding_for(object) end @@ -328,10 +329,10 @@ class Pry throw(:breakout) if current_binding.nil? end - # @deprecated - def repl - @@repl_warning ||= (warn "Pry#repl has been replaced by Pry::REPL.start(pry: pry)"; true) - Pry::REPL.start(:pry => self) + # @deprecated - Please use Pry::REPL.start(:pry => pry, :target => target) instead. + def repl(target=binding_stack.last) + @@repl_warning ||= (warn "(deprecation) Pry#repl has been replaced by Pry::REPL.start(:pry => pry)"; true) + Pry::REPL.start(:pry => self, :target => target) end def evaluate_ruby(code) diff --git a/lib/pry/repl.rb b/lib/pry/repl.rb index 90af314f..402c20bb 100644 --- a/lib/pry/repl.rb +++ b/lib/pry/repl.rb @@ -13,6 +13,9 @@ class Pry def initialize(options) @pry = options[:pry] || Pry.new(options) + if options[:pry] && options[:target] + @pry.push_binding options[:target] + end @indent = Pry::Indent.new end