Module: VCR::Cassette::Persisters::FileSystem
- Extended by:
- FileSystem
- Included in:
- FileSystem
- Defined in:
- lib/vcr/cassette/persisters/file_system.rb
Overview
The only built-in cassette persister. Persists cassettes to the file system.
Instance Method Summary (collapse)
-
- (String) [](file_name)
Gets the cassette for the given storage key (file name).
-
- (Object) []=(file_name, content)
Sets the cassette for the given storage key (file name).
Instance Method Details
- (String) [](file_name)
Gets the cassette for the given storage key (file name).
23 24 25 26 27 |
# File 'lib/vcr/cassette/persisters/file_system.rb', line 23 def [](file_name) path = absolute_path_to_file(file_name) return nil unless File.exist?(path) File.read(path) end |
- (Object) []=(file_name, content)
Sets the cassette for the given storage key (file name).
33 34 35 36 37 38 |
# File 'lib/vcr/cassette/persisters/file_system.rb', line 33 def []=(file_name, content) path = absolute_path_to_file(file_name) directory = File.dirname(path) FileUtils.mkdir_p(directory) unless File.exist?(directory) File.open(path, 'w') { |f| f.write(content) } end |