Class: WebSocketVCR::RecordedSession
- Inherits:
-
Object
- Object
- WebSocketVCR::RecordedSession
show all
- Defined in:
- lib/simple_websocket_vcr/cassette.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of RecordedSession.
84
85
86
|
# File 'lib/simple_websocket_vcr/cassette.rb', line 84
def initialize(entries)
@record_entries = entries
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
101
102
103
|
# File 'lib/simple_websocket_vcr/cassette.rb', line 101
def method_missing(method_name, *args, &block)
@record_entries.__send__(method_name, *args, &block)
end
|
Instance Attribute Details
#record_entries ⇒ Object
Returns the value of attribute record_entries.
82
83
84
|
# File 'lib/simple_websocket_vcr/cassette.rb', line 82
def record_entries
@record_entries
end
|
Instance Method Details
#head ⇒ Object
97
98
99
|
# File 'lib/simple_websocket_vcr/cassette.rb', line 97
def head
@record_entries.empty? ? nil : RecordEntry.parse(@record_entries.first)
end
|
#next ⇒ Object
93
94
95
|
# File 'lib/simple_websocket_vcr/cassette.rb', line 93
def next
RecordEntry.parse(@record_entries.shift)
end
|
#store(entry) ⇒ Object
88
89
90
91
|
# File 'lib/simple_websocket_vcr/cassette.rb', line 88
def store(entry)
hash = entry.is_a?(RecordEntry) ? entry.attributes.map(&:to_s) : entry.map { |k, v| [k.to_s, v.to_s] }.to_h
@record_entries << hash
end
|