Class: VCR::LinkedCassette::CassetteList
- Inherits:
-
Object
- Object
- VCR::LinkedCassette::CassetteList
- Includes:
- Enumerable
- Defined in:
- lib/vcr/linked_cassette.rb
Overview
An enumerable lazily wrapping a list of cassettes that a context is using
Instance Method Summary collapse
-
#each ⇒ Object
Yields linked cassettes first, and then context-owned cassettes.
-
#initialize(cassettes, linked_cassettes) ⇒ CassetteList
constructor
Creates a new list of context-owned cassettes and linked cassettes.
-
#last ⇒ Object
Provide last implementation, which is not provided by Enumerable.
-
#size ⇒ Object
Provide size implementation, which is not provided by Enumerable.
Constructor Details
#initialize(cassettes, linked_cassettes) ⇒ CassetteList
Creates a new list of context-owned cassettes and linked cassettes
14 15 16 17 |
# File 'lib/vcr/linked_cassette.rb', line 14 def initialize(cassettes, linked_cassettes) @cassettes = cassettes @linked_cassettes = linked_cassettes end |
Instance Method Details
#each ⇒ Object
Yields linked cassettes first, and then context-owned cassettes
20 21 22 23 24 25 26 27 28 |
# File 'lib/vcr/linked_cassette.rb', line 20 def each @linked_cassettes.each do |cassette| yield wrap(cassette) end @cassettes.each do |cassette| yield cassette end end |
#last ⇒ Object
Provide last implementation, which is not provided by Enumerable
31 32 33 34 35 36 37 |
# File 'lib/vcr/linked_cassette.rb', line 31 def last cassette = @cassettes.last return cassette if cassette cassette = @linked_cassettes.last wrap(cassette) if cassette end |
#size ⇒ Object
Provide size implementation, which is not provided by Enumerable
40 41 42 |
# File 'lib/vcr/linked_cassette.rb', line 40 def size @cassettes.size + @linked_cassettes.size end |