Object
# File lib/sinatra/base.rb, line 868 def initialize(app = nil) super() @app = app @template_cache = Tilt::Cache.new yield self if block_given? end
Rack call interface.
# File lib/sinatra/base.rb, line 876 def call(env) dup.call!(env) end
Forward the request to the downstream app – middleware only.
# File lib/sinatra/base.rb, line 934 def forward fail "downstream app not set" unless @app.respond_to? :call status, headers, body = @app.call env @response.status = status @response.body = body @response.headers.merge! headers nil end
Exit the current block, halts any further processing of the request, and returns the specified response.
# File lib/sinatra/base.rb, line 921 def halt(*response) response = response.first if response.length == 1 throw :halt, response end
# File lib/sinatra/base.rb, line 913 def options warn "Sinatra::Base#options is deprecated and will be removed, " "use #settings instead." settings end
Pass control to the next matching route. If there are no more matching routes, Sinatra will return a 404 response.
# File lib/sinatra/base.rb, line 929 def pass(&block) throw :pass, block end
Generated with the Darkfish Rdoc Generator 2.