Class: LetItGo::Middleware::Olaf
- Inherits:
-
Object
- Object
- LetItGo::Middleware::Olaf
- Defined in:
- lib/let_it_go/middleware/olaf.rb
Instance Method Summary collapse
- #asset_request?(path) ⇒ Boolean
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Olaf
constructor
A new instance of Olaf.
- #not_asset_request?(path) ⇒ Boolean
Constructor Details
#initialize(app) ⇒ Olaf
Returns a new instance of Olaf.
4 5 6 |
# File 'lib/let_it_go/middleware/olaf.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#asset_request?(path) ⇒ Boolean
8 9 10 |
# File 'lib/let_it_go/middleware/olaf.rb', line 8 def asset_request?(path) path.match(/^\/assets\/|favicon.ico$/i) end |
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/let_it_go/middleware/olaf.rb', line 16 def call(env) result = nil report = LetItGo.record do result = @app.call(env) end puts "" report.print if not_asset_request?(env["REQUEST_PATH".freeze]) result end |
#not_asset_request?(path) ⇒ Boolean
12 13 14 |
# File 'lib/let_it_go/middleware/olaf.rb', line 12 def not_asset_request?(path) !asset_request?(path) end |