class Sinatra::Default
Sinatra::Base instead and set options as needed.
Deprecated as base class for non-top-level apps. Subclass
def self.const_missing(const_name) #:nodoc:
def self.const_missing(const_name) #:nodoc: 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.inherited(subclass)
def self.inherited(subclass) sinatra_warn 'Sinatra::Default is deprecated; ' \ 'subclass Sinatra::Base instead' super 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 header(header=nil)
def header(header=nil) sinatra_warn "The 'header' method is deprecated; use 'headers' instead." headers(header) end
def invoke(&block) #:nodoc:
values.
deprecated. Override the invoke method to detect those types of return
Throwing halt with a Symbol and the to_result convention are
def invoke(&block) #:nodoc: 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) #:nodoc:
Deprecated. Missing messages are no longer delegated to @response.
def method_missing(name, *args, &b) #:nodoc: 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 #:nodoc:
def options #:nodoc: 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 render(engine, template, options={}, locals={}, &bk)
def render(engine, template, options={}, locals={}, &bk) if options.key?(:views_directory) sinatra_warn "The :views_directory option is deprecated; use :views instead." options[:views] = options.delete(:views_directory) end [:options, engine.to_sym].each do |key| if options.key?(key) sinatra_warn "Passing :#{key} => {} to #{engine} is deprecated; " + "merge options directly into hash instead." options.merge! options.delete(key) end end super(engine, template, options, locals, &bk) end
def send_data(data, options={})
Deprecated. Use the #attachment helper and return the data as a String or
def send_data(data, options={}) sinatra_warn "The 'send_data' method is deprecated. use attachment, status, content_type, etc. helpers instead." status options[:status] if options[:status] attachment options[:filename] if options[:disposition] == 'attachment' content_type options[:type] if options[:type] halt data 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