Class: Watchdocs::Rails::Middleware
- Defined in:
- lib/watchdocs/rails/middleware.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
6 7 8 9 |
# File 'lib/watchdocs/rails/middleware.rb', line 6 def initialize(app) @app = app @report = {} end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
4 5 6 |
# File 'lib/watchdocs/rails/middleware.rb', line 4 def app @app end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
4 5 6 |
# File 'lib/watchdocs/rails/middleware.rb', line 4 def report @report end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/watchdocs/rails/middleware.rb', line 11 def call(env) app.call(env).tap do |response| if json_response?(response) clear_report catch_request(env) catch_response(response) match_endpoint_pattern record_call end end end |