Sha256: 026c2038a6418df12817107714adb350bd915e2c30abfdcc5e1217e2f1d1a4c2
Contents?: true
Size: 681 Bytes
Versions: 3
Compression:
Stored size: 681 Bytes
Contents
# frozen_string_literal: true class Rack::App::Router::Tree::Vein < ::Hash def set(env) app = create_app(env) env.endpoint.request_methods.each do |request_method| self[request_method.to_s.upcase] = app end end def call(env) app = app_by(env) app && app.call(env) end protected def app_by(env) self[env[Rack::App::Constants::ENV::REQUEST_METHOD]] end def create_app(env) app = env.endpoint.to_app env.params.empty? ? app : wrap(app, env.params) end def wrap(app, params) builder = Rack::Builder.new builder.use(Rack::App::Middlewares::SetPathParams, params) builder.run(app) builder.to_app end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rack-app-6.0.0 | lib/rack/app/router/tree/vein.rb |
rack-app-5.12.0 | lib/rack/app/router/tree/vein.rb |
rack-app-5.11.1 | lib/rack/app/router/tree/vein.rb |