Class | Sinatra::Default |
In: |
lib/sinatra/base.rb
lib/sinatra/compat.rb lib/sinatra/main.rb |
Parent: | Base |
# File lib/sinatra/base.rb, line 836 836: def self.call(env) 837: reload! if reload? 838: super 839: end
# File lib/sinatra/base.rb, line 832 832: def self.configure(*envs) 833: super unless reloading? 834: end
# File lib/sinatra/compat.rb, line 76 76: def self.const_missing(const_name) 77: if const_name == :FORWARD_METHODS 78: sinatra_warn 'Sinatra::Application::FORWARD_METHODS is deprecated;', 79: 'use Sinatra::Delegator::METHODS instead.' 80: const_set :FORWARD_METHODS, Sinatra::Delegator::METHODS 81: Sinatra::Delegator::METHODS 82: else 83: super 84: end 85: end
Deprecated. Use: set
# File lib/sinatra/compat.rb, line 166 166: def default_options 167: sinatra_warn "Sinatra::Application.default_options is deprecated; use 'set' instead." 168: fake = lambda { |options| set(options) } 169: def fake.merge!(options) ; call(options) ; end 170: fake 171: end
Deprecated. Use: options.environment
# File lib/sinatra/compat.rb, line 191 191: def env 192: sinatra_warn "The :env option is deprecated; use :environment instead." 193: environment 194: end
Deprecated. Use: set :environment, ENV
# File lib/sinatra/compat.rb, line 185 185: def env=(value) 186: sinatra_warn "The :env option is deprecated; use :environment instead." 187: set :environment, value 188: end
Deprecated. Options are stored directly on the class object.
# File lib/sinatra/compat.rb, line 154 154: def options 155: sinatra_warn "The 'options' class method is deprecated; use 'self' instead." 156: Options.new(self) 157: end
# File lib/sinatra/base.rb, line 841 841: def self.reload! 842: @reloading = true 843: superclass.send :inherited, self 844: $LOADED_FEATURES.delete("sinatra.rb") 845: ::Kernel.load app_file 846: @reloading = false 847: end
Deprecated. Use: set
# File lib/sinatra/compat.rb, line 174 174: def set_optionset_option(*args, &block) 175: sinatra_warn "The 'set_option' method is deprecated; use 'set' instead." 176: set(*args, &block) 177: end
# File lib/sinatra/compat.rb, line 179 179: def set_options(*args, &block) 180: sinatra_warn "The 'set_options' method is deprecated; use 'set' instead." 181: set(*args, &block) 182: end
Deprecated. Use: etag
# File lib/sinatra/compat.rb, line 102 102: def entity_tag(*args, &block) 103: sinatra_warn "The 'entity_tag' method is deprecated; use 'etag' instead." 104: etag(*args, &block) 105: end
Deprecated. Use: response[‘Header-Name’]
# File lib/sinatra/compat.rb, line 88 88: def headers(header=nil) 89: sinatra_warn "The 'headers' method is deprecated; use 'response' instead." 90: response.headers.merge!(header) if header 91: response.headers 92: 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 121 121: def invoke(&block) 122: res = super 123: case 124: when res.kind_of?(Symbol) 125: sinatra_warn "Invoking the :#{res} helper by returning a Symbol is deprecated;", 126: "call the helper directly instead." 127: @response.body = __send__(res) 128: when res.respond_to?(:to_result) 129: sinatra_warn "The to_result convention is deprecated." 130: @response.body = res.to_result(self) 131: end 132: res 133: end
Deprecated. Missing messages are no longer delegated to @response.
# File lib/sinatra/compat.rb, line 198 198: def method_missing(name, *args, &b) 199: if @response.respond_to?(name) 200: sinatra_warn "The '#{name}' method is deprecated; use 'response.#{name}' instead." 201: @response.send(name, *args, &b) 202: else 203: super 204: end 205: end
The :disposition option is deprecated; use: attachment. This method setting the Content-Transfer-Encoding header is deprecated.
# File lib/sinatra/compat.rb, line 111 111: def send_file(path, opts={}) 112: opts[:disposition] = 'attachment' if !opts.key?(:disposition) 113: attachment opts[:filename] || path if opts[:filename] || opts[:disposition] 114: response['Content-Transfer-Encoding'] = 'binary' if opts[:disposition] 115: super(path, opts) 116: end