File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
activesupport/lib/active_support Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ module ActiveSupport
17
17
# can focus on the rest.
18
18
#
19
19
# bc = ActiveSupport::BacktraceCleaner.new
20
- # bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } # strip the Rails.root prefix
20
+ # root = "#{Rails.root}/"
21
+ # bc.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line } # strip the Rails.root prefix
21
22
# bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems
22
23
# bc.clean(exception.backtrace) # perform the cleanup
23
24
#
@@ -75,8 +76,9 @@ def clean_frame(frame, kind = :silent)
75
76
# Adds a filter from the block provided. Each line in the backtrace will be
76
77
# mapped against this filter.
77
78
#
78
- # # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb"
79
- # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root.to_s, '') }
79
+ # # Will turn "/my/rails/root/app/models/person.rb" into "app/models/person.rb"
80
+ # root = "#{Rails.root}/"
81
+ # backtrace_cleaner.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line }
80
82
def add_filter ( &block )
81
83
@filters << block
82
84
end
You can’t perform that action at this time.
0 commit comments