Class: Rack::Stackflame
- Inherits:
-
Object
- Object
- Rack::Stackflame
- Defined in:
- lib/rack/stackflame.rb
Constant Summary collapse
- ASSET_EXTNAMES =
%w[js css png jpg jpeg].freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}, &block) ⇒ Stackflame
constructor
A new instance of Stackflame.
Constructor Details
#initialize(app, options = {}, &block) ⇒ Stackflame
Returns a new instance of Stackflame.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/rack/stackflame.rb', line 5 def initialize(app, = {}, &block) @app = app = .dup if block_given? @block = block else @block = -> (env) { not_asset_request?(env) } end end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rack/stackflame.rb', line 16 def call(env) result = nil stackflame = ::Stackflame.new stackflame.run() do result = @app.call(env) end if @block.call(env) stackflame.open_flamegraph end result end |