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.


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

def initialize(responder)
  @responder = responder
end

Instance Attribute Details

#responderObject

Returns the value of attribute responder


148
149
150
# File 'lib/webmock/response.rb', line 148

def responder
  @responder
end

Instance Method Details

#evaluate(request_signature) ⇒ Object


154
155
156
157
# File 'lib/webmock/response.rb', line 154

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