Allow CALLERS_TO_IGNORE to be overridden

This commit is contained in:
Jordan Owens 2022-12-15 00:33:59 -05:00
parent d3357cb0c0
commit 0b2c3a7c5a
1 changed files with 5 additions and 1 deletions

View File

@ -1222,6 +1222,10 @@ module Sinatra
attr_reader :routes, :filters, :templates, :errors
def callers_to_ignore
CALLERS_TO_IGNORE
end
# Removes all routes, filters, middleware and extension hooks from the
# current class (not routes/filters/... defined by its superclass).
def reset!
@ -1788,7 +1792,7 @@ module Sinatra
def cleaned_caller(keep = 3)
caller(1)
.map! { |line| line.split(/:(?=\d|in )/, 3)[0, keep] }
.reject { |file, *_| CALLERS_TO_IGNORE.any? { |pattern| file =~ pattern } }
.reject { |file, *_| callers_to_ignore.any? { |pattern| file =~ pattern } }
end
end