From 8a434a747d1e5bb2c1a7c49ad35382f493ec671f Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 18 Dec 2012 00:26:51 -0800 Subject: [PATCH] Don't pass target to run_command either --- lib/pry.rb | 2 +- lib/pry/pry_instance.rb | 7 ++----- spec/command_integration_spec.rb | 7 ------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/pry.rb b/lib/pry.rb index 718e3e42..54a26b1f 100644 --- a/lib/pry.rb +++ b/lib/pry.rb @@ -10,7 +10,7 @@ class Pry # The default hooks - display messages when beginning and ending Pry sessions. DEFAULT_HOOKS = Pry::Hooks.new.add_hook(:before_session, :default) do |out, target, _pry_| next if _pry_.quiet? - _pry_.run_command("whereami --quiet", "", target) + _pry_.run_command("whereami --quiet") end # The default print diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index d1abf562..5634d934 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -205,7 +205,6 @@ class Pry end # Initialize the repl session. - # @param [Binding] target The target binding for the session. def repl_prologue exec_hook :before_session, output, current_binding, self set_last_result nil @@ -214,7 +213,6 @@ class Pry end # Clean-up after the repl session. - # @param [Binding] target The target binding for the session. def repl_epilogue exec_hook :after_session, output, current_binding, self @@ -450,14 +448,13 @@ class Pry # Run the specified command. # @param [String] val The command (and its params) to execute. # @param [String] eval_string The current input buffer. - # @param [Binding] target The binding to use.. # @return [Pry::Command::VOID_VALUE] # @example # pry_instance.run_command("ls -m") - def run_command(val, eval_string = "", target = binding_stack.last) + def run_command(val, eval_string = "") commands.process_line(val, :eval_string => eval_string, - :target => target, + :target => current_binding, :pry_instance => self, :output => output ) diff --git a/spec/command_integration_spec.rb b/spec/command_integration_spec.rb index 673c18c4..237fc555 100644 --- a/spec/command_integration_spec.rb +++ b/spec/command_integration_spec.rb @@ -215,13 +215,6 @@ describe "commands" do end describe "Pry#run_command" do - it 'should run a command in a specified context' do - b = Pry.binding_for(7) - p = Pry.new(:output => @str_output) - p.run_command("ls -m", "", b) - p.output.string.should =~ /divmod/ - end - it 'should run a command that modifies the passed in eval_string' do p = Pry.new(:output => @str_output) p.push_binding 7