module RSpec::Core::Hooks

def find_hook(hook, scope, example_or_group, initial_procsy)

def find_hook(hook, scope, example_or_group, initial_procsy)
  case [hook, scope]
  when [:before, :all]
    before_all_hooks_for(example_or_group)
  when [:after, :all]
    after_all_hooks_for(example_or_group)
  when [:around, :each]
    around_each_hooks_for(example_or_group, initial_procsy)
  when [:before, :each]
    before_each_hooks_for(example_or_group)
  when [:after, :each]
    after_each_hooks_for(example_or_group)
  when [:before, :suite], [:after, :suite]
    hooks[hook][:suite].with(example_or_group)
  end
end