class Rack::App::Endpoint::Executor

Public Class Methods

new(endpoint_properties) click to toggle source
# File lib/rack/app/endpoint/executor.rb, line 3
def initialize(endpoint_properties)
  @endpoint_properties = endpoint_properties
  @catcher = Rack::App::Endpoint::Catcher.new(proc{ |env| execute(env) }, endpoint_properties)
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/app/endpoint/executor.rb, line 8
def call(env)
  @catcher.call(env)
end

Protected Instance Methods

evaluate_value(request_handler) click to toggle source
# File lib/rack/app/endpoint/executor.rb, line 23
def evaluate_value(request_handler)
  @endpoint_properties.error_handler.execute_with_error_handling_for(request_handler) do
    request_handler.instance_exec(&@endpoint_properties.callable)
  end
end
execute(env) click to toggle source
# File lib/rack/app/endpoint/executor.rb, line 14
def execute(env)
  resp = evaluate_value(env[Rack::App::Constants::ENV::HANDLER])
  throw type(resp), resp
end
type(resp) click to toggle source
# File lib/rack/app/endpoint/executor.rb, line 19
def type(resp)
  resp.is_a?(Rack::Response) ? :rack_response : :response_body
end