module Sinatra::Sugar::BaseMethods

Public Instance Methods

callers_to_ignore() click to toggle source
# File lib/sinatra/sugar.rb, line 9
def callers_to_ignore
  class << Sinatra::Base
    CALLERS_TO_IGNORE
  end
end
ignore_caller(pattern = nil) click to toggle source
# File lib/sinatra/sugar.rb, line 15
def ignore_caller(pattern = nil)
  case pattern
  when String then Dir.glob(pattern) { |file| ignore_caller File.expand_path(file).to_sym }
  when Symbol then ignore_caller Regexp.new(Regexp.escape(pattern.to_s))
  when Regexp then callers_to_ignore << pattern
  when nil    then ignore_caller caller.first[%r^[^:]*/].to_sym
  when Array  then pattern.each { |p| ignore_caller p }
  else raise ArgumentError, "cannot handle #{pattern.inspect}"
  end
end