Module: Sinatra

Defined in:
lib/sinatra/base.rb,
lib/sinatra/main.rb,
lib/sinatra/showexceptions.rb

Defined Under Namespace

Modules: Delegator, Helpers, Templates Classes: Application, Base, NotFound, Request, Response, ShowExceptions

Constant Summary collapse

VERSION =
'0.10.1'
Default =

Deprecated.

Application

Class Method Summary collapse

Class Method Details

.helpers(*extensions, &block) ⇒ Object

Include the helper modules provided in Sinatra’s request context.



1106
1107
1108
# File 'lib/sinatra/base.rb', line 1106

def self.helpers(*extensions, &block)
  Application.helpers(*extensions, &block)
end

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

Create a new Sinatra application. The block is evaluated in the new app’s class scope.



1094
1095
1096
1097
1098
# File 'lib/sinatra/base.rb', line 1094

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

.register(*extensions, &block) ⇒ Object

Extend the top-level DSL with the modules provided.



1101
1102
1103
# File 'lib/sinatra/base.rb', line 1101

def self.register(*extensions, &block)
  Application.register(*extensions, &block)
end