Class Sinatra::Default

  1. lib/sinatra/base.rb
  2. lib/sinatra/compat.rb
  3. lib/sinatra/main.rb
  4. show all
Parent: Sinatra::Base

Public class methods

call (env)
[show source]
     # File lib/sinatra/base.rb, line 800
800:     def self.call(env)
801:       reload! if reload?
802:       super
803:     end
configure (*envs)
[show source]
     # File lib/sinatra/base.rb, line 796
796:     def self.configure(*envs)
797:       super unless reloading?
798:     end
configures (*args, &block)

Deprecated. Use: configure

[show source]
     # 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
const_missing (const_name)
[show source]
    # 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
default_options ()

Deprecated. Use: set

[show source]
     # 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
env ()

Deprecated. Use: options.environment

[show source]
     # 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
env= (value)

Deprecated. Use: set :environment, ENV

[show source]
     # 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
options ()

Deprecated. Options are stored directly on the class object.

[show source]
     # 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
reload! ()
[show source]
     # 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
reloading? ()
[show source]
     # File lib/sinatra/base.rb, line 792
792:     def self.reloading?
793:       @reloading ||= false
794:     end
set_option (*args, &block)

Deprecated. Use: set

[show source]
     # 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
set_options (*args, &block)
[show source]
     # 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

entity_tag (*args, &block)

Deprecated. Use: etag

[show source]
    # 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
header (header=nil)

Alias for headers

headers (header=nil)

Deprecated. Use: response[‘Header-Name’]

[show source]
    # 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
invoke (handler)

Throwing halt with a Symbol and the to_result convention are deprecated. Override the invoke method to detect those types of return values.

[show source]
     # 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
method_missing (name, *args, &b)

Deprecated. Missing messages are no longer delegated to @response.

[show source]
     # 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
options ()
[show source]
     # File lib/sinatra/compat.rb, line 124
124:     def options
125:       Options.new(self.class)
126:     end
send_file (path, opts={})

The :disposition option is deprecated; use: attachment. This method setting the Content-Transfer-Encoding header is deprecated.

[show source]
     # 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
stop (*args, &block)

Deprecated. Use: halt

[show source]
    # 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