Class: Modware::Stack::Middleware
- Inherits:
-
Object
- Object
- Modware::Stack::Middleware
- Defined in:
- lib/modware/stack.rb
Instance Attribute Summary collapse
-
#_next ⇒ Object
Returns the value of attribute _next.
Instance Method Summary collapse
- #_call(env, base_implementation) ⇒ Object
- #_continue(env, base_implementation) ⇒ Object
-
#initialize(stack, mod) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(stack, mod) ⇒ Middleware
Returns a new instance of Middleware.
55 56 57 58 |
# File 'lib/modware/stack.rb', line 55 def initialize(stack, mod) @stack = stack singleton_class.send :include, mod end |
Instance Attribute Details
#_next ⇒ Object
Returns the value of attribute _next.
53 54 55 |
# File 'lib/modware/stack.rb', line 53 def _next @_next end |
Instance Method Details
#_call(env, base_implementation) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/modware/stack.rb', line 60 def _call(env, base_implementation) if respond_to? :around around(env) { |env| _continue env, base_implementation } else _continue env, base_implementation end end |
#_continue(env, base_implementation) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/modware/stack.rb', line 70 def _continue(env, base_implementation) if self._next self._next._call(env, base_implementation) else @stack.send :call_implementation, env, base_implementation end end |