Class: Logput::Middleware
- Inherits:
-
Object
- Object
- Logput::Middleware
- Defined in:
- lib/logput/middleware.rb
Overview
Middleware
Instance Method Summary collapse
-
#call(env) ⇒ Object
Call.
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
5 6 7 8 9 |
# File 'lib/logput/middleware.rb', line 5 def initialize(app, = {}) @app = app @path_to_log_file = [:path_to_log_file] @lines_to_read = [:lines_to_read] || 500 end |
Instance Method Details
#call(env) ⇒ Object
Call
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/logput/middleware.rb', line 12 def call(env) @env = env @path_to_log_file ||= default_path_to_log_file ensure_log_file_exists! if is_logput? generate_output! else @app.call(@env) end end |