Class: VCR::Hooks::FilteredHook

Inherits:
Struct
  • Object
show all
Includes:
VariableArgsBlockCaller
Defined in:
lib/vcr/util/hooks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from VariableArgsBlockCaller

#call_block

Instance Attribute Details

#filtersObject

Returns the value of attribute filters

Returns:

  • (Object)

    the current value of filters



9
10
11
# File 'lib/vcr/util/hooks.rb', line 9

def filters
  @filters
end

#hookObject

Returns the value of attribute hook

Returns:

  • (Object)

    the current value of hook



9
10
11
# File 'lib/vcr/util/hooks.rb', line 9

def hook
  @hook
end

Instance Method Details

#conditionally_invoke(*args) ⇒ Object



12
13
14
15
16
# File 'lib/vcr/util/hooks.rb', line 12

def conditionally_invoke(*args)
  filters = Array(self.filters)
  return if filters.any? { |f| !call_block(f.to_proc, *args) }
  call_block(hook, *args)
end