From 0b2c3a7c5a55ceb208a24843c1315c06da638a15 Mon Sep 17 00:00:00 2001 From: Jordan Owens Date: Thu, 15 Dec 2022 00:33:59 -0500 Subject: [PATCH] Allow CALLERS_TO_IGNORE to be overridden --- lib/sinatra/base.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index f345bd84..ba330a46 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -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