1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

improve Pry::Hooks#hook_exists? method

This commit is contained in:
John Mair 2012-11-27 22:41:32 +01:00
parent c52f94079c
commit e5ad6fc561

View file

@ -244,7 +244,7 @@ class Pry
# @param [Symbol] hook_name Name of the hook.
# @return [Boolean] Whether the hook by the name `hook_name`
def hook_exists?(event_name, hook_name)
!!@hooks[event_name].find { |name, _| name == hook_name }
!!(@hooks[event_name] && @hooks[event_name].find { |name, _| name == hook_name })
end
end
end