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



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

def filters
  @filters
end

#hookObject

Returns the value of attribute hook

Returns:

  • (Object)

    the current value of hook



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

def hook
  @hook
end

Instance Method Details

#conditionally_invoke(*args) ⇒ Object



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

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