Class: LetItGo::Middleware::Olaf

Inherits:
Object
  • Object
show all
Defined in:
lib/let_it_go/middleware/olaf.rb

Instance Method Summary collapse

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

Returns:

  • (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

Returns:

  • (Boolean)


12
13
14
# File 'lib/let_it_go/middleware/olaf.rb', line 12

def not_asset_request?(path)
  !asset_request?(path)
end