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.6'

Class Method Summary collapse

Class Method Details

.helpers(*extensions, &block) ⇒ Object

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



1519
1520
1521
# File 'lib/sinatra/base.rb', line 1519

def self.helpers(*extensions, &block)
  Delegator.target.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.



1507
1508
1509
1510
1511
# File 'lib/sinatra/base.rb', line 1507

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.



1514
1515
1516
# File 'lib/sinatra/base.rb', line 1514

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