Class: Ovto::Middleware::Base
- Inherits:
-
Object
- Object
- Ovto::Middleware::Base
- Defined in:
- lib/ovto/middleware.rb
Overview
Base class of a middleware class Note: this is not the direct superclass of a middleware. `SomeMiddleware < (anonymous class) < Middleware::Base`
Class Method Summary collapse
- ._run_setup(wired_action_set) ⇒ Object
-
.middlewares ⇒ Object
Nested middlewares.
-
.name ⇒ Object
Middleware name (set by Ovto.Middleware).
-
.use(middleware_class) ⇒ Object
Install a nested middleware.
Instance Method Summary collapse
- #actions ⇒ Object
-
#initialize(wired_actions) ⇒ Base
constructor
A new instance of Base.
-
#setup ⇒ Object
Override this if needed.
Constructor Details
#initialize(wired_actions) ⇒ Base
Returns a new instance of Base.
73 74 75 |
# File 'lib/ovto/middleware.rb', line 73 def initialize(wired_actions) @wired_actions = wired_actions end |
Class Method Details
._run_setup(wired_action_set) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/ovto/middleware.rb', line 65 def self._run_setup(wired_action_set) mw = new(wired_action_set[WiredActionSet::THE_MIDDLEWARE_ITSELF]) mw.setup self.middlewares.each do |m| m._run_setup(wired_action_set[m.name]) end end |
.middlewares ⇒ Object
Nested middlewares
51 52 53 |
# File 'lib/ovto/middleware.rb', line 51 def self.middlewares @middlewares ||= [] end |
.name ⇒ Object
Middleware name (set by Ovto.Middleware)
61 62 63 |
# File 'lib/ovto/middleware.rb', line 61 def self.name const_get(:OVTO_MIDDLEWARE_NAME) end |
.use(middleware_class) ⇒ Object
Install a nested middleware
56 57 58 |
# File 'lib/ovto/middleware.rb', line 56 def self.use(middleware_class) self.middlewares.push(middleware_class) end |
Instance Method Details
#actions ⇒ Object
81 82 83 |
# File 'lib/ovto/middleware.rb', line 81 def actions @wired_actions end |
#setup ⇒ Object
Override this if needed
78 79 |
# File 'lib/ovto/middleware.rb', line 78 def setup end |