class Sinatra::Base

def cleaned_caller(keep = 3)

Like Kernel#caller but excluding certain magic entries
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 } }
end