Class: VCR::Middleware::CassetteArguments

Inherits:
Object
  • Object
show all
Defined in:
lib/vcr/middleware/rack.rb

Overview

Object yielded by VCR's Rack middleware that allows you to configure the cassette dynamically based on the rack env.

Instance Method Summary collapse

Constructor Details

#initializeCassetteArguments

Returns a new instance of CassetteArguments.


7
8
9
10
# File 'lib/vcr/middleware/rack.rb', line 7

def initialize
  @name    = nil
  @options = {}
end

Instance Method Details

#name(name = nil) ⇒ #to_s

Sets (and gets) the cassette name.

Parameters:

  • name (#to_s) (defaults to: nil)

    the cassette name

Returns:

  • (#to_s)

    the cassette name


16
17
18
19
# File 'lib/vcr/middleware/rack.rb', line 16

def name(name = nil)
  @name = name if name
  @name
end

#options(options = {}) ⇒ Hash

Sets (and gets) the cassette options.

Parameters:

  • options (Hash) (defaults to: {})

    the cassette options

Returns:

  • (Hash)

    the cassette options


25
26
27
# File 'lib/vcr/middleware/rack.rb', line 25

def options(options = {})
  @options.merge!(options)
end