compat.rb

lib/sinatra/compat.rb
Last Update: Tue Jan 13 12:59:00 -0800 2009

Sinatra 0.3.x compatibility module.

The following code makes Sinatra 0.9.x compatible with Sinatra 0.3.x to ease the transition to the final 1.0 release. Everything defined in this file will be removed for the 1.0 release.

Methods

public instance

  1. sinatra_warn

Required files

  1. ostruct
  2. sinatra/base
  3. sinatra/main
  4. swiftcore/swiftiplied_mongrel
  5. swiftcore/evented_mongrel
  6. rack/file

Public instance methods

sinatra_warn (*message)

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

[show source]
    # File lib/sinatra/compat.rb, line 12
12: def sinatra_warn(*message)
13:   line = caller.
14:     detect { |line| line !~ /(?:lib\/sinatra\/|__DELEGATE__)/ }.
15:     sub(/:in .*/, '')
16:   warn "#{line}: warning: #{message.join(' ')}"
17: end