Sha256: e1bae91a7244b6ca15fd44977c29a1bad73f721f2fb46bc2b3e48f17d44e866a
Contents?: true
Size: 1.24 KB
Versions: 85
Compression:
Stored size: 1.24 KB
Contents
module VCR class Cassette # Keeps track of the cassette persisters in a hash-like object. class Persisters autoload :FileSystem, 'vcr/cassette/persisters/file_system' # @private def initialize @persisters = {} end # Gets the named persister. # # @param name [Symbol] the name of the persister # @return the named persister # @raise [ArgumentError] if there is not a persister for the given name def [](name) @persisters.fetch(name) do |_| @persisters[name] = case name when :file_system then FileSystem else raise ArgumentError, "The requested VCR cassette persister " + "(#{name.inspect}) is not registered." end end end # Registers a persister. # # @param name [Symbol] the name of the persister # @param value [#[], #[]=] the persister object. It must implement `[]` and `[]=`. def []=(name, value) if @persisters.has_key?(name) warn "WARNING: There is already a VCR cassette persister " + "registered for #{name.inspect}. Overriding it." end @persisters[name] = value end end end end
Version data entries
85 entries across 85 versions & 10 rubygems