mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
9c66bad9f3
* test/rake*: ditto * bin/rake: ditto * NEWS: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
18 lines
617 B
Ruby
18 lines
617 B
Ruby
module Rake
|
|
module Backtrace
|
|
SUPPRESSED_PATHS =
|
|
RbConfig::CONFIG.values_at(*RbConfig::CONFIG.
|
|
keys.grep(/(prefix|libdir)/)) + [
|
|
File.join(File.dirname(__FILE__), ".."),
|
|
].map { |f| Regexp.quote(File.expand_path(f)) }
|
|
SUPPRESSED_PATHS.reject! { |s| s.nil? || s =~ /^ *$/ }
|
|
|
|
SUPPRESS_PATTERN = %r!(\A#{SUPPRESSED_PATHS.join('|')}|bin/rake:\d+)!i
|
|
|
|
def self.collapse(backtrace)
|
|
pattern = Rake.application.options.suppress_backtrace_pattern ||
|
|
SUPPRESS_PATTERN
|
|
backtrace.reject { |elem| elem =~ pattern }
|
|
end
|
|
end
|
|
end
|