mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
hooks: rename #clear to #clear_event hooks and get rid of the alias
This commit is contained in:
parent
a3a9831b5c
commit
590d73658f
3 changed files with 3 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue