Sha256: 5b557768f7667f5399720bed9a302a6b06ef0315212f82441bc51ee0795075c3
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true require 'rack/builder' class Rack::App::Endpoint::Builder def initialize(config) @config = config end def to_app build.to_app end protected def build builder = Rack::Builder.new apply_middleware_build_blocks(builder) builder.run(app) builder end def app case @config.type when :endpoint Rack::App::Endpoint::Executor.new(@config) else @config.callable end end def apply_middleware_build_blocks(builder) @config.middlewares.each do |builder_block| builder.instance_exec(builder, &builder_block) end builder.use(Rack::App::Middlewares::Configuration, @config) apply_hook_middlewares(builder) end def apply_hook_middlewares(builder) if @config.app_class.before.length + @config.app_class.after.length > 0 builder.use(Rack::App::Endpoint::Catcher, @config) end @config.app_class.before.each do |before_block| builder.use(Rack::App::Middlewares::Hooks::Before, before_block) end @config.app_class.after.each do |after_block| builder.use(Rack::App::Middlewares::Hooks::After, after_block) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rack-app-7.3.2 | lib/rack/app/endpoint/builder.rb |
rack-app-7.3.1 | lib/rack/app/endpoint/builder.rb |
rack-app-7.3.0 | lib/rack/app/endpoint/builder.rb |