diff --git a/lib/pry/hooks.rb b/lib/pry/hooks.rb index 1fc55d69..8e75513b 100644 --- a/lib/pry/hooks.rb +++ b/lib/pry/hooks.rb @@ -200,13 +200,11 @@ class Pry # @example # my_hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" } # my_hooks.delete_hook(:before_session) - def delete_hooks(event_name) + def clear_event_hooks(event_name) event_name = event_name.to_s @hooks[event_name] = [] end - alias_method :clear, :delete_hooks - # Remove all events and hooks, clearing out the Pry::Hooks # instance completely. # @example diff --git a/spec/commands/watch_expression_spec.rb b/spec/commands/watch_expression_spec.rb index 97b79263..28f7dcf4 100644 --- a/spec/commands/watch_expression_spec.rb +++ b/spec/commands/watch_expression_spec.rb @@ -14,7 +14,7 @@ describe "watch expression" do before do @tester = pry_tester - @tester.pry.hooks.clear :after_eval + @tester.pry.hooks.clear_event_hooks(:after_eval) eval "watch --delete" end diff --git a/spec/hooks_spec.rb b/spec/hooks_spec.rb index 01274c69..28ff6207 100644 --- a/spec/hooks_spec.rb +++ b/spec/hooks_spec.rb @@ -212,7 +212,7 @@ describe Pry::Hooks do @hooks.add_hook(:test_hook, :my_name) { } @hooks.add_hook(:test_hook, :my_name2) { } @hooks.add_hook(:test_hook, :my_name3) { } - @hooks.clear(:test_hook) + @hooks.clear_event_hooks(:test_hook) expect(@hooks.hook_count(:test_hook)).to eq 0 end end