Top Level Namespace

Includes:
Sinatra::Delegator

Defined Under Namespace

Modules: Rack, Sinatra Classes: String

Instance Method Summary collapse

Methods included from Sinatra::Delegator

delegate

Instance Method Details

#mime(ext, type) ⇒ Object



39
40
41
42
# File 'lib/sinatra/main.rb', line 39

def mime(ext, type)
  ext = ".#{ext}" unless ext.to_s[0] == ?.
  Rack::Mime::MIME_TYPES[ext.to_s] = type
end

#sinatra_warn(*message) ⇒ Object

Like Kernel#warn but outputs the location that triggered the warning.



12
13
14
15
16
17
# File 'lib/sinatra/compat.rb', line 12

def sinatra_warn(*message) #:nodoc:
  line = caller.
    detect { |line| line !~ /(?:lib\/sinatra\/|__DELEGATE__)/ }.
    sub(/:in .*/, '')
  warn "#{line}: warning: #{message.join(' ')}"
end