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, Default, NotFound, Request, Response, ShowExceptions

Constant Summary collapse

VERSION =
'0.10.1'

Class Method Summary collapse

Class Method Details

.helpers(*extensions, &block) ⇒ Object

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



1140
1141
1142
# File 'lib/sinatra/base.rb', line 1140

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



1128
1129
1130
1131
1132
# File 'lib/sinatra/base.rb', line 1128

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.



1135
1136
1137
# File 'lib/sinatra/base.rb', line 1135

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