Class: FluentLoggerStatistics::Middleware
- Inherits:
-
Object
- Object
- FluentLoggerStatistics::Middleware
- Defined in:
- lib/fluent_logger_statistics/middleware.rb
Constant Summary collapse
- ACCEPT_METHODS =
['GET'].freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, path, loggers) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, path, loggers) ⇒ Middleware
Returns a new instance of Middleware.
5 6 7 8 9 |
# File 'lib/fluent_logger_statistics/middleware.rb', line 5 def initialize(app, path, loggers) @app = app @path = path @fluent_app = App.new(loggers) end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/fluent_logger_statistics/middleware.rb', line 13 def call(env) if env['PATH_INFO'] == @path && ACCEPT_METHODS.include?(env['REQUEST_METHOD']) @fluent_app.call(env) else @app.call(env) end end |