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.8.2 lib/jets/middleware.rb
jets-1.8.1 lib/jets/middleware.rb
jets-1.8.0 lib/jets/middleware.rb
jets-1.7.2 lib/jets/middleware.rb
jets-1.7.1 lib/jets/middleware.rb
jets-1.7.0 lib/jets/middleware.rb
jets-fs-1.6.10 lib/jets/middleware.rb
jets-1.6.9 lib/jets/middleware.rb
jets-1.6.8 lib/jets/middleware.rb
jets-1.6.7 lib/jets/middleware.rb
jets-1.6.6 lib/jets/middleware.rb
jets-1.6.5 lib/jets/middleware.rb
jets-1.6.4 lib/jets/middleware.rb
jets-1.6.3 lib/jets/middleware.rb
jets-1.6.2 lib/jets/middleware.rb
jets-1.6.1 lib/jets/middleware.rb
jets-1.6.0 lib/jets/middleware.rb
jets-1.5.10 lib/jets/middleware.rb
jets-1.5.9 lib/jets/middleware.rb
jets-1.5.8 lib/jets/middleware.rb