Top Level Namespace
- Includes:
- Sinatra::Delegator
Defined Under Namespace
Modules: Sinatra
Constant Summary
Constants included from Sinatra::Delegator
Instance Method Summary collapse
- #helpers(&block) ⇒ Object
- #mime(ext, type) ⇒ Object
-
#sinatra_warn(*message) ⇒ Object
Like Kernel#warn but outputs the location that triggered the warning.
Instance Method Details
#helpers(&block) ⇒ Object
36 37 38 |
# File 'lib/sinatra/main.rb', line 36 def helpers(&block) Sinatra::Application.send :class_eval, &block end |
#mime(ext, type) ⇒ Object
40 41 42 43 |
# File 'lib/sinatra/main.rb', line 40 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(*) line = caller. detect { |line| line !~ /(?:lib\/sinatra\/|__DELEGATE__)/ }. sub(/:in .*/, '') warn "#{line}: warning: #{.join(' ')}" end |