Sha256: f85805b6ab927572ae406733c3abdb65aee069c5e57c58d466982a90c437cfae

Contents?: true

Size: 710 Bytes

Versions: 33

Compression:

Stored size: 710 Bytes

Contents

class Rack::App::Endpoint::Executor

  def initialize(endpoint_properties)
    @endpoint_properties = endpoint_properties
    @catcher = Rack::App::Endpoint::Catcher.new(proc{ |env| execute(env) }, endpoint_properties)
  end

  def call(env)
    @catcher.call(env)
  end

  protected

  def execute(env)
    resp = evaluate_value(env[Rack::App::Constants::ENV::HANDLER])
    throw type(resp), resp
  end

  def type(resp)
    resp.is_a?(Rack::Response) ? :rack_response : :response_body
  end

  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

end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
rack-app-7.3.2 lib/rack/app/endpoint/executor.rb
rack-app-7.3.1 lib/rack/app/endpoint/executor.rb
rack-app-7.3.0 lib/rack/app/endpoint/executor.rb
rack-app-7.2.2 lib/rack/app/endpoint/executor.rb
rack-app-7.2.1 lib/rack/app/endpoint/executor.rb
rack-app-7.2.0 lib/rack/app/endpoint/executor.rb
rack-app-7.1.0 lib/rack/app/endpoint/executor.rb
rack-app-7.0.0 lib/rack/app/endpoint/executor.rb
rack-app-6.8.0 lib/rack/app/endpoint/executor.rb
rack-app-6.7.1 lib/rack/app/endpoint/executor.rb
rack-app-6.7.0 lib/rack/app/endpoint/executor.rb
rack-app-6.6.0 lib/rack/app/endpoint/executor.rb
rack-app-6.5.0 lib/rack/app/endpoint/executor.rb