Methods
public class
- call
- configure
- configures
- const_missing
- default_options
- env
- env=
- options
- reload!
- reloading?
- set_option
- set_options
public instance
Public class methods
# File lib/sinatra/base.rb, line 800 800: def self.call(env) 801: reload! if reload? 802: super 803: end
# File lib/sinatra/base.rb, line 796 796: def self.configure(*envs) 797: super unless reloading? 798: end
Deprecated. Use: configure
# File lib/sinatra/compat.rb, line 149 149: def configures(*args, &block) 150: sinatra_warn "The 'configures' method is deprecated; use 'configure' instead." 151: configure(*args, &block) 152: end
# File lib/sinatra/compat.rb, line 65 65: def self.const_missing(const_name) 66: if const_name == :FORWARD_METHODS 67: sinatra_warn 'Sinatra::Application::FORWARD_METHODS is deprecated;', 68: 'use Sinatra::Delegator::METHODS instead.' 69: const_set :FORWARD_METHODS, Sinatra::Delegator::METHODS 70: Sinatra::Delegator::METHODS 71: else 72: super 73: end 74: end
Deprecated. Use: set
# File lib/sinatra/compat.rb, line 155 155: def default_options 156: sinatra_warn "Sinatra::Application.default_options is deprecated; use 'set' instead." 157: fake = lambda { |options| set(options) } 158: def fake.merge!(options) ; call(options) ; end 159: fake 160: end
Deprecated. Use: options.environment
# File lib/sinatra/compat.rb, line 180 180: def env 181: sinatra_warn "The :env option is deprecated; use :environment instead." 182: environment 183: end
Deprecated. Use: set :environment, ENV
# File lib/sinatra/compat.rb, line 174 174: def env=(value) 175: sinatra_warn "The :env option is deprecated; use :environment instead." 176: set :environment, value 177: end
Deprecated. Options are stored directly on the class object.
# File lib/sinatra/compat.rb, line 143 143: def options 144: sinatra_warn "The 'options' class method is deprecated; use 'self' instead." 145: Options.new(self) 146: end
# File lib/sinatra/base.rb, line 805 805: def self.reload! 806: @reloading = true 807: superclass.send :inherited, self 808: $LOADED_FEATURES.delete("sinatra.rb") 809: ::Kernel.load app_file 810: @reloading = false 811: end
# File lib/sinatra/base.rb, line 792 792: def self.reloading? 793: @reloading ||= false 794: end
Deprecated. Use: set
# File lib/sinatra/compat.rb, line 163 163: def set_optionset_option(*args, &block) 164: sinatra_warn "The 'set_option' method is deprecated; use 'set' instead." 165: set(*args, &block) 166: end
# File lib/sinatra/compat.rb, line 168 168: def set_options(*args, &block) 169: sinatra_warn "The 'set_options' method is deprecated; use 'set' instead." 170: set(*args, &block) 171: end
Public instance methods
Deprecated. Use: etag
# File lib/sinatra/compat.rb, line 91 91: def entity_tag(*args, &block) 92: sinatra_warn "The 'entity_tag' method is deprecated; use 'etag' instead." 93: etag(*args, &block) 94: end
Deprecated. Use: response[‘Header-Name’]
# File lib/sinatra/compat.rb, line 77 77: def headers(header=nil) 78: sinatra_warn "The 'headers' method is deprecated; use 'response' instead." 79: response.headers.merge!(header) if header 80: response.headers 81: end
Throwing halt with a Symbol and the to_result convention are deprecated. Override the invoke method to detect those types of return values.
# File lib/sinatra/compat.rb, line 110 110: def invoke(handler) 111: res = super 112: case 113: when res.kind_of?(Symbol) 114: sinatra_warn "Invoking the :#{res} helper by returning a Symbol is deprecated;", 115: "call the helper directly instead." 116: @response.body = __send__(res) 117: when res.respond_to?(:to_result) 118: sinatra_warn "The to_result convention is deprecated." 119: @response.body = res.to_result(self) 120: end 121: res 122: end
Deprecated. Missing messages are no longer delegated to @response.
# File lib/sinatra/compat.rb, line 187 187: def method_missing(name, *args, &b) 188: if @response.respond_to?(name) 189: sinatra_warn "The '#{name}' method is deprecated; use 'response.#{name}' instead." 190: @response.send(name, *args, &b) 191: else 192: super 193: end 194: end
# File lib/sinatra/compat.rb, line 124 124: def options 125: Options.new(self.class) 126: end
The :disposition option is deprecated; use: attachment. This method setting the Content-Transfer-Encoding header is deprecated.
# File lib/sinatra/compat.rb, line 100 100: def send_file(path, opts={}) 101: opts[:disposition] = 'attachment' if !opts.key?(:disposition) 102: attachment opts[:filename] || path if opts[:filename] || opts[:disposition] 103: response['Content-Transfer-Encoding'] = 'binary' if opts[:disposition] 104: super(path, opts) 105: end
Deprecated. Use: halt
# File lib/sinatra/compat.rb, line 85 85: def stop(*args, &block) 86: sinatra_warn "The 'stop' method is deprecated; use 'halt' instead." 87: halt(*args, &block) 88: end