Class: WebMock::DynamicResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/webmock/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Response

#==, #body, #body=, #exception, #exception=, #headers, #headers=, #options=, #raise_error_if_any, #should_timeout, #status, #status=

Constructor Details

#initialize(responder) ⇒ DynamicResponse

Returns a new instance of DynamicResponse.



152
153
154
# File 'lib/webmock/response.rb', line 152

def initialize(responder)
  @responder = responder
end

Instance Attribute Details

#responderObject

Returns the value of attribute responder.



150
151
152
# File 'lib/webmock/response.rb', line 150

def responder
  @responder
end

Instance Method Details

#evaluate(request_signature) ⇒ Object



156
157
158
159
# File 'lib/webmock/response.rb', line 156

def evaluate(request_signature)
  options = @responder.call(request_signature)
  Response.new(options)
end