class Rack::App::Router::Tree::Leaf::Mounted::Application

Public Class Methods

new(endpoint) click to toggle source
# File lib/rack/app/router/tree/leaf/mounted/application.rb, line 5
def initialize(endpoint)
  @app = build(endpoint)
end

Protected Instance Methods

build(endpoint) click to toggle source
# File lib/rack/app/router/tree/leaf/mounted/application.rb, line 9
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
mount_path(endpoint) click to toggle source
# File lib/rack/app/router/tree/leaf/mounted/application.rb, line 16
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