Sha256: 3cd33eea6987da9541dc288198b6960cea73de6473b85eb048359d2cf5d48c38

Contents?: true

Size: 982 Bytes

Versions: 78

Compression:

Stored size: 982 Bytes

Contents

module Jets
  module Middleware
    extend Memoist

    autoload :Configurator, 'jets/middleware/configurator'
    autoload :DefaultStack, 'jets/middleware/default_stack'
    autoload :Layer, 'jets/middleware/layer'
    autoload :Stack, 'jets/middleware/stack'

    def call(env)
      stack = middlewares.build(endpoint)
      stack.call(env)
    end

    # Final middleware in the stack
    def endpoint
      Jets::Controller::Middleware::Main
    end

    # Called in Jets::Booter to build middleware stack only once during bootup
    def build_stack
      middlewares
    end

    def middlewares
      config_middleware.merge_into(default_stack) # returns Jets::Middleware::Stack
    end
    memoize :middlewares

    def default_stack
      Jets::Middleware::DefaultStack.new(Jets.config, Jets.application).build_stack # returns Jets::Middleware::Stack
    end

    def config_middleware
      Jets.config.middleware # returns Jets::Middleware::Configurator
    end
  end
end

Version data entries

78 entries across 78 versions & 2 rubygems

Version Path
jets-1.9.7 lib/jets/middleware.rb
jets-1.9.6 lib/jets/middleware.rb
jets-1.9.5 lib/jets/middleware.rb
jets-1.9.4 lib/jets/middleware.rb
jets-1.9.3 lib/jets/middleware.rb
jets-1.9.2 lib/jets/middleware.rb
jets-1.9.1 lib/jets/middleware.rb
jets-1.9.0 lib/jets/middleware.rb
jets-1.8.14 lib/jets/middleware.rb
jets-1.8.13 lib/jets/middleware.rb
jets-1.8.12 lib/jets/middleware.rb
jets-1.8.11 lib/jets/middleware.rb
jets-1.8.10 lib/jets/middleware.rb
jets-1.8.9 lib/jets/middleware.rb
jets-1.8.8 lib/jets/middleware.rb
jets-1.8.7 lib/jets/middleware.rb
jets-1.8.6 lib/jets/middleware.rb
jets-1.8.5 lib/jets/middleware.rb
jets-1.8.4 lib/jets/middleware.rb
jets-1.8.3 lib/jets/middleware.rb