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 =
'1.2.1'

Class Method Summary collapse

Class Method Details

.helpers(*extensions, &block) ⇒ Object

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



1470
1471
1472
# File 'lib/sinatra/base.rb', line 1470

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.



1458
1459
1460
1461
1462
# File 'lib/sinatra/base.rb', line 1458

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

.register(*extensions, &block) ⇒ Object

Extend the top-level DSL with the modules provided.



1465
1466
1467
# File 'lib/sinatra/base.rb', line 1465

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