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
19
20
21
22
23
24
25
26
|
# File 'lib/vcr/util/hooks.rb', line 19
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
34
35
36
|
# File 'lib/vcr/util/hooks.rb', line 34
def clear_hooks
hooks.clear
end
|
#has_hooks_for?(hook_type) ⇒ Boolean
44
45
46
|
# File 'lib/vcr/util/hooks.rb', line 44
def has_hooks_for?(hook_type)
hooks[hook_type].any?
end
|
#hooks ⇒ Object
38
39
40
41
42
|
# File 'lib/vcr/util/hooks.rb', line 38
def hooks
@hooks ||= Hash.new do |hash, hook_type|
hash[hook_type] = []
end
end
|
#invoke_hook(hook_type, *args) ⇒ Object
28
29
30
31
32
|
# File 'lib/vcr/util/hooks.rb', line 28
def invoke_hook(hook_type, *args)
hooks[hook_type].map do |hook|
hook.conditionally_invoke(*args)
end
end
|