class Rack::Stackflame
Constants
- ASSET_EXTNAMES
Public Class Methods
new(app, options = {}, &block)
click to toggle source
# File lib/rack/stackflame.rb, line 5 def initialize(app, options = {}, &block) @app = app @options = options.dup if block_given? @block = block else @block = -> (env) { not_asset_request?(env) } end end
Public Instance Methods
call(env)
click to toggle source
# File lib/rack/stackflame.rb, line 16 def call(env) result = nil if @block.call(env) stackflame = ::Stackflame.new stackflame.run(@options) do result = @app.call(env) end stackflame.open_flamegraph(request: env['PATH_INFO']) else result = @app.call(env) end result end
Private Instance Methods
not_asset_request?(env)
click to toggle source
# File lib/rack/stackflame.rb, line 34 def not_asset_request?(env) path = env['PATH_INFO'] return false unless path extname = Pathname.new(path).extname.gsub(/\A\./, '') !ASSET_EXTNAMES.include?(extname) end