1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Allow CALLERS_TO_IGNORE to be overridden

This commit is contained in:
Jordan Owens 2022-12-15 13:43:12 -05:00
parent c135ceb94e
commit 5788f4683f

View file

@ -1237,6 +1237,10 @@ module Sinatra
attr_reader :routes, :filters, :templates, :errors attr_reader :routes, :filters, :templates, :errors
def callers_to_ignore
CALLERS_TO_IGNORE
end
# Removes all routes, filters, middleware and extension hooks from the # Removes all routes, filters, middleware and extension hooks from the
# current class (not routes/filters/... defined by its superclass). # current class (not routes/filters/... defined by its superclass).
def reset! def reset!
@ -1786,7 +1790,7 @@ module Sinatra
def cleaned_caller(keep = 3) def cleaned_caller(keep = 3)
caller(1). caller(1).
map! { |line| line.split(/:(?=\d|in )/, 3)[0,keep] }. 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
end end