Module: Elastic::Core::Middleware
Instance Method Summary collapse
Instance Method Details
#middleware_for(_target) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/elastic/core/middleware.rb', line 13 def middleware_for(_target) # TODO: improve matching logic middleware = middlewares.reverse_each.find { |m| m.accepts?(_target) } middleware = DefaultMiddleware if middleware.nil? middleware end |
#register(_middleware_class) ⇒ Object
5 6 7 |
# File 'lib/elastic/core/middleware.rb', line 5 def register(_middleware_class) middlewares << _middleware_class end |
#wrap(_target) ⇒ Object
9 10 11 |
# File 'lib/elastic/core/middleware.rb', line 9 def wrap(_target) middleware_for(_target).new _target end |