Module: Sinatra

Defined in:
lib/sinatra/base.rb,
lib/sinatra/main.rb,
lib/sinatra/test.rb,
lib/sinatra/compat.rb

Defined Under Namespace

Modules: Compat, Delegator, Helpers, Templates, Test Classes: Application, Base, Default, NotFound, Request, Response, ServerError, TestHarness

Constant Summary collapse

VERSION =
'0.9.0.2'

Class Method Summary collapse

Class Method Details

.applicationObject

Deprecated. Use: Sinatra::Application



199
200
201
202
# File 'lib/sinatra/compat.rb', line 199

def application
  sinatra_warn "Sinatra.application is deprecated; use Sinatra::Application instead."
  Sinatra::Application
end

.application=(value) ⇒ Object

Deprecated. Use: Sinatra::Application.reset!

Raises:

  • (ArgumentError)


205
206
207
208
209
210
211
212
# File 'lib/sinatra/compat.rb', line 205

def application=(value)
  raise ArgumentError unless value.nil?
  sinatra_warn "Setting Sinatra.application to nil is deprecated; create a new instance instead."
  Sinatra.class_eval do
    remove_const :Application
    const_set :Application, Class.new(Sinatra::Default)
  end
end

.build_applicationObject



214
215
216
217
# File 'lib/sinatra/compat.rb', line 214

def build_application
  sinatra_warn "Sinatra.build_application is deprecated; use Sinatra::Application instead."
  Sinatra::Application
end

.envObject



234
235
236
237
# File 'lib/sinatra/compat.rb', line 234

def env
  sinatra_warn "Sinatra.env is deprecated; use Sinatra::Application.environment instead."
  options.environment
end

.hostObject



229
230
231
232
# File 'lib/sinatra/compat.rb', line 229

def host
  sinatra_warn "Sinatra.host is deprecated; use Sinatra::Application.host instead."
  options.host
end

.new(base = Base, options = {}, &block) ⇒ Object



861
862
863
864
865
# File 'lib/sinatra/base.rb', line 861

def self.new(base=Base, options={}, &block)
  base = Class.new(base)
  base.send :class_eval, &block if block_given?
  base
end

.optionsObject



219
220
221
222
# File 'lib/sinatra/compat.rb', line 219

def options
  sinatra_warn "Sinatra.options is deprecated; use Sinatra::Application.option_name instead."
  Sinatra::Application.options
end

.portObject



224
225
226
227
# File 'lib/sinatra/compat.rb', line 224

def port
  sinatra_warn "Sinatra.port is deprecated; use Sinatra::Application.port instead."
  options.port
end