Sha256: 40b4e05bde4c4bd10ef87d9e219a96a4426449bbf27100cec1dd5c87faa9adca
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
module Padrino # List of callers in a Padrino application that should be ignored as part of a stack trace. PADRINO_IGNORE_CALLERS = [ %r{lib/padrino-.*$}, %r{/padrino-.*/(lib|bin)}, %r{/bin/padrino$}, %r{/sinatra(/(base|main|show_?exceptions))?\.rb$}, %r{lib/tilt.*\.rb$}, %r{lib/rack.*\.rb$}, %r{lib/mongrel.*\.rb$}, %r{lib/shotgun.*\.rb$}, %r{bin/shotgun$}, %r{\(.*\)}, %r{shoulda/context\.rb$}, %r{mocha/integration}, %r{test/unit}, %r{rake_test_loader\.rb}, %r{custom_require\.rb$}, %r{active_support}, %r{/thor}, %r{/lib/bundler} ] unless defined?(PADRINO_IGNORE_CALLERS) ## # Add rubinius (and hopefully other VM implementations) ignore patterns ... # PADRINO_IGNORE_CALLERS.concat(RUBY_IGNORE_CALLERS) if defined?(RUBY_IGNORE_CALLERS) ## # The filename for the file that is the direct caller (first caller). # # @return [String] # The file the caller method exists in. # def self.first_caller caller_files.first end # # Like +Kernel#caller+ but excluding certain magic entries and without # line / method information; the resulting array contains filenames only. # # @return [Array<String>] # The files of the calling methods. # def self.caller_files caller(1). map { |line| line.split(/:(?=\d|in )/)[0,2] }. reject { |file,_line| PADRINO_IGNORE_CALLERS.any? { |pattern| file =~ pattern } }. map { |file,_line| file } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
padrino-core-0.16.0.pre3 | lib/padrino-core/caller.rb |
padrino-core-0.16.0.pre2 | lib/padrino-core/caller.rb |