Class: VCR::Cassette::Persisters
- Inherits:
-
Object
- Object
- VCR::Cassette::Persisters
- 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
-
#[](name) ⇒ Object
Gets the named persister.
-
#[]=(name, value) ⇒ Object
Registers a persister.
-
#initialize ⇒ Persisters
constructor
A new instance of Persisters.
Constructor Details
#initialize ⇒ Persisters
Returns a new instance of Persisters.
8 9 10 |
# File 'lib/vcr/cassette/persisters.rb', line 8 def initialize @persisters = {} end |
Instance Method Details
#[](name) ⇒ Object
Gets the named persister.
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 |