From 71251c5e7f0c11fb88dbd91e14dda2b8fff08dc1 Mon Sep 17 00:00:00 2001 From: Robert Gleeson Date: Mon, 20 Jan 2014 16:00:22 +0100 Subject: [PATCH] fix (most of) sticky_local_spec.rb. --- lib/pry/pry_instance.rb | 4 ++-- spec/sticky_locals_spec.rb | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index b30cfff9..a03441f6 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -153,7 +153,7 @@ class Pry # @yield The block that defines the content of the local. The local # will be refreshed at each tick of the repl loop. def add_sticky_local(name, &block) - sticky_locals[name] = block + config.extra_sticky_locals[name] = block end def sticky_locals @@ -165,7 +165,7 @@ class Pry _dir_: last_dir, _: last_result, __: output_array[-2] - } + }.merge(config.extra_sticky_locals) end # Reset the current eval string. If the user has entered part of a multiline diff --git a/spec/sticky_locals_spec.rb b/spec/sticky_locals_spec.rb index bda34ffa..0bf933ca 100644 --- a/spec/sticky_locals_spec.rb +++ b/spec/sticky_locals_spec.rb @@ -44,13 +44,11 @@ describe "Sticky locals (_file_ and friends)" do describe "setting as Pry.config option" do it 'should define a new sticky local for the session (normal value)' do Pry.config.extra_sticky_locals[:test_local] = :john - o = Object.new redirect_pry_io(InputTester.new("@value = test_local", "exit-all")) do Pry.start(o) end - o.instance_variable_get(:@value).should == :john Pry.config.extra_sticky_locals = {} end