Sha256: 730bb93c8ac8b5143e1c90491d9d08f4b918f9747ff0b52bea8ece6e71e7b8d4
Contents?: true
Size: 777 Bytes
Versions: 70
Compression:
Stored size: 777 Bytes
Contents
require 'set' require 'vcr/util/hooks' module VCR # @private class RequestIgnorer include VCR::Hooks define_hook :ignore_request LOCALHOST_ALIASES = %w( localhost 127.0.0.1 0.0.0.0 ) def initialize ignore_request do |request| host = request.parsed_uri.host ignored_hosts.include?(host) end end def ignore_localhost=(value) if value ignore_hosts(*LOCALHOST_ALIASES) else ignored_hosts.reject! { |h| LOCALHOST_ALIASES.include?(h) } end end def ignore_hosts(*hosts) ignored_hosts.merge(hosts) end def ignore?(request) invoke_hook(:ignore_request, request).any? end private def ignored_hosts @ignored_hosts ||= Set.new end end end
Version data entries
70 entries across 70 versions & 9 rubygems