class VCR::Cassette::Persisters
Keeps track of the cassette persisters in a hash-like object.
Public Class Methods
new()
click to toggle source
@private
# File lib/vcr/cassette/persisters.rb, line 8 def initialize @persisters = {} end
Public Instance Methods
[](name)
click to toggle source
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
# File lib/vcr/cassette/persisters.rb, line 17 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
[]=(name, value)
click to toggle source
Registers a persister.
@param name [Symbol] the name of the persister @param value [#[], []=] the persister object. It must implement `[]` and `[]=`.
# File lib/vcr/cassette/persisters.rb, line 31 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