Class: Racket::Utils::Application::HandlerStack
- Inherits:
-
Object
- Object
- Racket::Utils::Application::HandlerStack
- Defined in:
- lib/racket/utils/application/handler_stack.rb
Overview
Class used for building a proper Rack application.
Instance Attribute Summary collapse
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Class Method Summary collapse
-
.service(_options = {}) ⇒ Proc
Returns a service proc that can be used by the registry.
Instance Method Summary collapse
-
#initialize(options) ⇒ HandlerStack
constructor
A new instance of HandlerStack.
Constructor Details
#initialize(options) ⇒ HandlerStack
Returns a new instance of HandlerStack.
54 55 56 57 58 |
# File 'lib/racket/utils/application/handler_stack.rb', line 54 def initialize() @stack = Rack::Builder.new @options = OpenStruct.new() build end |
Instance Attribute Details
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
26 27 28 |
# File 'lib/racket/utils/application/handler_stack.rb', line 26 def stack @stack end |
Class Method Details
.service(_options = {}) ⇒ Proc
Returns a service proc that can be used by the registry.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/racket/utils/application/handler_stack.rb', line 32 def self.service( = {}) lambda do |reg| settings = reg.application_settings = { default_content_type: settings.default_content_type, default_controller_helpers: settings.default_controller_helpers, dev_mode: settings.mode == :dev, logger: reg.application_logger, middleware: settings.middleware, plugins: settings.plugins, router: reg.router, session_handler: settings.session_handler, static_server: reg.static_server, utils: reg.utils, warmup_urls: settings.warmup_urls } new().stack end end |