Sha256: 63d6a52d183bd92aee660ae89c484eda8e74878aa4e3c173228a476650185562
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
module Rack class Stackflame ASSET_EXTNAMES = %w[js css png jpg jpeg].freeze def initialize(app, options = {}, &block) @app = app @options = options.dup if block_given? @block = block else @block = -> (env) { not_asset_request?(env) } end end def call(env) result = nil stackflame = ::Stackflame.new stackflame.run(@options) do result = @app.call(env) end if @block.call(env) stackflame.open_flamegraph(request: env['PATH_INFO']) end result end private 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stackflame-0.2.4 | lib/rack/stackflame.rb |