Class: DbDebug::Middleware
- Inherits:
-
Object
- Object
- DbDebug::Middleware
- Defined in:
- lib/db_debug/middleware.rb
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.
3 4 5 |
# File 'lib/db_debug/middleware.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/db_debug/middleware.rb', line 7 def call(env) str = env["QUERY_STRING"].gsub(/&db_debug/, "") db_debug = env["QUERY_STRING"] != str env["QUERY_STRING"] = str if db_debug DbDebug.trace verbose: db_debug.present? do @app.call(env) end end |