Class: MockServer::Record
- Inherits:
-
Object
- Object
- MockServer::Record
- Includes:
- Store, Utils
- Defined in:
- lib/mock_server/record.rb
Instance Method Summary (collapse)
- - (Object) call(env)
-
- (Record) initialize(app, opt = {})
constructor
A new instance of Record.
Methods included from Store
#mock_server_options_merge, #mock_server_options_read, #mock_server_options_write
Constructor Details
- (Record) initialize(app, opt = {})
A new instance of Record
13 14 15 16 |
# File 'lib/mock_server/record.rb', line 13 def initialize(app, opt = {}) @app = app @options = (opt) end |
Instance Method Details
- (Object) call(env)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mock_server/record.rb', line 18 def call(env) @options = self. verbose(env) if @options[:verbose] return @app.call(env) unless @options[:routes] and lazy_match @options[:routes], env["PATH_INFO"] @request = Rack::Request.new(env) @data = load_data @app.call(env).tap do |status, header, response| record_response(status, header, response) self.(@options) response end end |