Class: VCR::Cassette::Persisters

Inherits:
Object
  • Object
show all
Defined in:
lib/vcr/cassette/persisters.rb,
lib/vcr/cassette/persisters/file_system.rb

Overview

Keeps track of the cassette persisters in a hash-like object.

Defined Under Namespace

Modules: FileSystem

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object

Gets the named persister.

Raises:

  • (ArgumentError)

    if there is not a persister for the given name



17
18
19
20
21
22
23
24
25
# 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) ⇒ Object

Registers a persister.



31
32
33
34
35
36
37
38
# 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