Sha256: 8bfb12106fdd4e04b001ed68bdfa52e2e060bacedcb56f6fb18f82ca7a3aa00b
Contents?: true
Size: 1.18 KB
Versions: 19
Compression:
Stored size: 1.18 KB
Contents
module Rack::Insight module FilteredBacktrace def backtrace @backtrace end def has_backtrace? filtered_backtrace.any? end def filtered_backtrace @filtered_backtrace ||= @backtrace.respond_to?(:grep) ? @backtrace.grep(FilteredBacktrace.backtrace_regexp) : [] end def self.backtrace_regexp @backtrace_regexp ||= begin if !Rack::Insight::Config.filtered_backtrace || (app_root = root_for_backtrace_filtering).nil? /.*/ else excludes = %w{vendor} %r{^#{app_root}(?:#{::File::Separator}(?!#{excludes.join("|")}).+)$} end end end def self.root_for_backtrace_filtering(sub_path = nil) if defined?(Rails) && Rails.respond_to?(:root) sub_path ? Rails.root.join(sub_path) : Rails.root else root = if defined?(RAILS_ROOT) RAILS_ROOT elsif defined?(ROOT) ROOT elsif defined?(Sinatra::Application) Sinatra::Application.root else nil end sub_path ? ::File.join(root, sub_path) : root end end end end
Version data entries
19 entries across 19 versions & 1 rubygems