Module: Sinatra::Sugar::BaseMethods

Extended by:
BaseMethods
Included in:
BaseMethods
Defined in:
lib/sinatra/sugar.rb

Instance Method Summary collapse

Instance Method Details

#callers_to_ignoreObject



9
10
11
12
13
# File 'lib/sinatra/sugar.rb', line 9

def callers_to_ignore
  class << Sinatra::Base
    CALLERS_TO_IGNORE
  end
end

#ignore_caller(pattern = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# 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[/^[^:]*/].to_sym
  when Array  then pattern.each { |p| ignore_caller p }
  else raise ArgumentError, "cannot handle #{pattern.inspect}"
  end
end