class VCR::HTTPInteraction::HookAware

for a ‘before_record` or `before_playback` hook.
Decorates an {HTTPInteraction} with additional methods useful

def filter!(text, replacement_text)

Parameters:
  • replacement_text (#to_s) -- the text to put in its place
  • text (#to_s) -- the text to replace
def filter!(text, replacement_text)
  text, replacement_text = text.to_s, replacement_text.to_s
  return self if [text, replacement_text].any? { |t| t.empty? }
  filter_object!(self, text, replacement_text)
end

def filter_hash!(hash, text, replacement_text)

def filter_hash!(hash, text, replacement_text)
  filter_object!(hash.values, text, replacement_text)
  hash.keys.each do |k|
    new_key = filter_object!(k.dup, text, replacement_text)
    hash[new_key] = hash.delete(k) unless k == new_key
  end
end

def filter_object!(object, text, replacement_text)

def filter_object!(object, text, replacement_text)
  if object.respond_to?(:gsub)
    object.gsub!(text, replacement_text) if object.include?(text)
  elsif Hash === object
    filter_hash!(object, text, replacement_text)
  elsif object.respond_to?(:each)
    # This handles nested arrays and structs
    object.each { |o| filter_object!(o, text, replacement_text) }
  end
  object
end

def ignore!

Other tags:
    See: #ignored? -
def ignore!
  @ignored = true
end

def ignored?

Other tags:
    See: #ignore! -

Returns:
  • (Boolean) - whether or not this HTTP interaction should be ignored.
def ignored?
  !!@ignored
end

def initialize(http_interaction)

def initialize(http_interaction)
  @ignored = false
  super
end