Module: VCR::Hooks
Defined Under Namespace
Modules: ClassMethods
Classes: FilteredHook
Class Method Summary
collapse
Instance Method Summary
collapse
#call_block
Class Method Details
.included(klass) ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/vcr/util/hooks.rb', line 18
def self.included(klass)
klass.class_eval do
extend ClassMethods
hooks_module = Module.new
const_set("DefinedHooks", hooks_module)
include hooks_module
end
end
|
Instance Method Details
#clear_hooks ⇒ Object
33
34
35
|
# File 'lib/vcr/util/hooks.rb', line 33
def clear_hooks
hooks.clear
end
|
#has_hooks_for?(hook_type) ⇒ Boolean
43
44
45
|
# File 'lib/vcr/util/hooks.rb', line 43
def has_hooks_for?(hook_type)
hooks[hook_type].any?
end
|
#hooks ⇒ Object
37
38
39
40
41
|
# File 'lib/vcr/util/hooks.rb', line 37
def hooks
@hooks ||= Hash.new do |hash, hook_type|
hash[hook_type] = []
end
end
|
#invoke_hook(hook_type, *args) ⇒ Object
27
28
29
30
31
|
# File 'lib/vcr/util/hooks.rb', line 27
def invoke_hook(hook_type, *args)
hooks[hook_type].map do |hook|
hook.conditionally_invoke(*args)
end
end
|