class Sinatra::Default
def self.call(env)
def self.call(env) reload! if reload? super end
def self.configure(*envs)
def self.configure(*envs) super unless reloading? end
def self.const_missing(const_name)
def self.const_missing(const_name) if const_name == :FORWARD_METHODS sinatra_warn 'Sinatra::Application::FORWARD_METHODS is deprecated;', 'use Sinatra::Delegator::METHODS instead.' const_set :FORWARD_METHODS, Sinatra::Delegator::METHODS Sinatra::Delegator::METHODS else super end end
def self.reload!
def self.reload! @reloading = true superclass.send :inherited, self $LOADED_FEATURES.delete("sinatra.rb") ::Kernel.load app_file @reloading = false end
def self.reloading?
def self.reloading? @reloading ||= false end
def configures(*args, &block)
def configures(*args, &block) sinatra_warn "The 'configures' method is deprecated; use 'configure' instead." configure(*args, &block) end
def default_options
def default_options sinatra_warn "Sinatra::Application.default_options is deprecated; use 'set' instead." fake = lambda { |options| set(options) } def fake.merge!(options) ; call(options) ; end fake end
def entity_tag(*args, &block)
def entity_tag(*args, &block) sinatra_warn "The 'entity_tag' method is deprecated; use 'etag' instead." etag(*args, &block) end
def env
def env sinatra_warn "The :env option is deprecated; use :environment instead." environment end
def env=(value)
def env=(value) sinatra_warn "The :env option is deprecated; use :environment instead." set :environment, value end
def headers(header=nil)
def headers(header=nil) sinatra_warn "The 'headers' method is deprecated; use 'response' instead." response.headers.merge!(header) if header response.headers end
def invoke(handler)
deprecated. Override the invoke method to detect those types of return
Throwing halt with a Symbol and the to_result convention are
def invoke(handler) res = super case when res.kind_of?(Symbol) sinatra_warn "Invoking the :#{res} helper by returning a Symbol is deprecated;", "call the helper directly instead." @response.body = __send__(res) when res.respond_to?(:to_result) sinatra_warn "The to_result convention is deprecated." @response.body = res.to_result(self) end res end
def method_missing(name, *args, &b)
def method_missing(name, *args, &b) if @response.respond_to?(name) sinatra_warn "The '#{name}' method is deprecated; use 'response.#{name}' instead." @response.send(name, *args, &b) else super end end
def options
def options Options.new(self.class) end
def options
def options sinatra_warn "The 'options' class method is deprecated; use 'self' instead." Options.new(self) end
def send_file(path, opts={})
--
setting the Content-Transfer-Encoding header is deprecated.
The :disposition option is deprecated; use: #attachment. This method
def send_file(path, opts={}) opts[:disposition] = 'attachment' if !opts.key?(:disposition) attachment opts[:filename] || path if opts[:filename] || opts[:disposition] response['Content-Transfer-Encoding'] = 'binary' if opts[:disposition] super(path, opts) end
def set_option(*args, &block)
def set_option(*args, &block) sinatra_warn "The 'set_option' method is deprecated; use 'set' instead." set(*args, &block) end
def set_options(*args, &block)
def set_options(*args, &block) sinatra_warn "The 'set_options' method is deprecated; use 'set' instead." set(*args, &block) end
def stop(*args, &block)
def stop(*args, &block) sinatra_warn "The 'stop' method is deprecated; use 'halt' instead." halt(*args, &block) end