Sha256: da273d918165787a5887af57e6340560336abec432c1d80777a024bee61e5a50

Contents?: true

Size: 612 Bytes

Versions: 44

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true
class Rack::App::Router::Tree::Leaf::Mounted::Application < Rack::App::Router::Tree::Leaf::Mounted
  protected

  def initialize(endpoint)
    @app = build(endpoint)
  end

  def build(endpoint)
    builder = Rack::Builder.new
    builder.use(Rack::App::Middlewares::PathInfoCutter, mount_path(endpoint))
    builder.run(endpoint.to_app)
    builder.to_app
  end

  def mount_path(endpoint)
    mount_path_parts = (endpoint.request_path.split('/') - [Rack::App::Constants::PATH::APPLICATION, ''])
    mount_path_parts.empty? ? '' : Rack::App::Utils.join(mount_path_parts)
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
rack-app-11.0.2 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-11.0.1 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-11.0.0 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-10.0.0 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-9.0.0 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-8.1.0 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-8.0.1 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-8.0.0 lib/rack/app/router/tree/leaf/mounted/application.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/rack-app-7.7.0/lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.7.0 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.6.5 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.6.4 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.6.3 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.6.2 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.6.1 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.6.0 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.5.2 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.5.1 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.5.0 lib/rack/app/router/tree/leaf/mounted/application.rb
rack-app-7.4.0 lib/rack/app/router/tree/leaf/mounted/application.rb