From ed26866c899f1f34eaf5d3185c4b09766d749457 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Wed, 29 Jan 2014 00:05:48 +0900 Subject: [PATCH] Fix watch_expression to access correct hooks Now by refactoring config, Pry.config and @pry.config have different hooks. So to access correct pry config hooks, fix Pry::Command::WatchExpression.add_hook. --- lib/pry/commands/watch_expression.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pry/commands/watch_expression.rb b/lib/pry/commands/watch_expression.rb index 05d8e36e..24724123 100644 --- a/lib/pry/commands/watch_expression.rb +++ b/lib/pry/commands/watch_expression.rb @@ -82,8 +82,8 @@ class Pry def add_hook hook = [:after_eval, :watch_expression] - unless Pry.hooks.hook_exists?(*hook) - Pry.hooks.add_hook(*hook) do |_, _pry_| + unless _pry_.hooks.hook_exists?(*hook) + _pry_.hooks.add_hook(*hook) do |_, _pry_| eval_and_print_changed _pry_.output end end