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-11.0.2 lib/rack/app/endpoint/executor.rb
rack-app-11.0.1 lib/rack/app/endpoint/executor.rb
rack-app-11.0.0 lib/rack/app/endpoint/executor.rb
rack-app-10.0.0 lib/rack/app/endpoint/executor.rb
rack-app-9.0.0 lib/rack/app/endpoint/executor.rb
rack-app-8.1.0 lib/rack/app/endpoint/executor.rb
rack-app-8.0.1 lib/rack/app/endpoint/executor.rb
rack-app-8.0.0 lib/rack/app/endpoint/executor.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/rack-app-7.7.0/lib/rack/app/endpoint/executor.rb
rack-app-7.7.0 lib/rack/app/endpoint/executor.rb
rack-app-7.6.5 lib/rack/app/endpoint/executor.rb
rack-app-7.6.4 lib/rack/app/endpoint/executor.rb
rack-app-7.6.3 lib/rack/app/endpoint/executor.rb
rack-app-7.6.2 lib/rack/app/endpoint/executor.rb
rack-app-7.6.1 lib/rack/app/endpoint/executor.rb
rack-app-7.6.0 lib/rack/app/endpoint/executor.rb
rack-app-7.5.2 lib/rack/app/endpoint/executor.rb
rack-app-7.5.1 lib/rack/app/endpoint/executor.rb
rack-app-7.5.0 lib/rack/app/endpoint/executor.rb
rack-app-7.4.0 lib/rack/app/endpoint/executor.rb