hooks: rename #clear to #clear_event hooks and get rid of the alias

This commit is contained in:
Kyrylo Silin 2015-03-14 10:08:16 +02:00
parent a3a9831b5c
commit 590d73658f
3 changed files with 3 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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