Class: MockServer::Playback
- Inherits:
-
Object
- Object
- MockServer::Playback
- Defined in:
- lib/mock_server/playback.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opt = {}) ⇒ Playback
constructor
A new instance of Playback.
Methods included from Store
#mock_server_options_merge, #mock_server_options_read, #mock_server_options_write
Constructor Details
#initialize(app, opt = {}) ⇒ Playback
Returns a new instance of Playback.
16 17 18 19 |
# File 'lib/mock_server/playback.rb', line 16 def initialize(app, opt = {}) @app = app @options = (opt) end |
Instance Method Details
#call(env) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mock_server/playback.rb', line 21 def call(env) @options = self. verbose(env) if @options[:verbose] return @app.call(env) unless matchable_request?(env) @request = Rack::Request.new(env) @options[:requests_stack] << @request.path @data = load_data response = build_response self.(@options) response end |