Sha256: 8aba4a4dbd276977420ce5707d014d4dc12fd71ac7d41e9e0f7e01f40aeaf029

Contents?: true

Size: 952 Bytes

Versions: 16

Compression:

Stored size: 952 Bytes

Contents

class Rack::App::Endpoint

  require "forwardable"
  extend Forwardable
  def_delegators :@config, :request_method, :request_path, :description

  require "rack/app/endpoint/config"
  require "rack/app/endpoint/builder"
  require "rack/app/endpoint/catcher"
  require "rack/app/endpoint/executor"

  attr_reader :config

  def initialize(properties)
    @config = Rack::App::Endpoint::Config.new(properties)
  end

  def fork(differences_in_properties)
    self.class.new(self.properties.merge(differences_in_properties))
  end

  def properties
    @config.to_hash
  end

  def call(env)
    to_app.call(env)
  end

  def to_app
    # TODO: fix this to cache it, but to that you need to resolve the problem when middlewares added,
    # old endpoints are not refreshed by the middleware configs
    # router.reset must be checked
    self.class::Builder.new(@config).to_app
  end

  def rack_app?
    !!@config.app_class
  rescue
    false
  end

end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
rack-app-11.0.2 lib/rack/app/endpoint.rb
rack-app-11.0.1 lib/rack/app/endpoint.rb
rack-app-11.0.0 lib/rack/app/endpoint.rb
rack-app-10.0.0 lib/rack/app/endpoint.rb
rack-app-9.0.0 lib/rack/app/endpoint.rb
rack-app-8.1.0 lib/rack/app/endpoint.rb
rack-app-8.0.1 lib/rack/app/endpoint.rb
rack-app-8.0.0 lib/rack/app/endpoint.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/rack-app-7.7.0/lib/rack/app/endpoint.rb
rack-app-7.7.0 lib/rack/app/endpoint.rb
rack-app-7.6.5 lib/rack/app/endpoint.rb
rack-app-7.6.4 lib/rack/app/endpoint.rb
rack-app-7.6.3 lib/rack/app/endpoint.rb
rack-app-7.6.2 lib/rack/app/endpoint.rb
rack-app-7.6.1 lib/rack/app/endpoint.rb
rack-app-7.6.0 lib/rack/app/endpoint.rb