Methods
public class
public instance
Attributes
| app | [RW] | |
| conditions | [RW] | |
| env | [RW] | |
| errors | [RW] | |
| filters | [RW] | |
| middleware | [RW] | |
| params | [RW] | |
| request | [RW] | |
| response | [RW] | |
| routes | [RW] | |
| templates | [RW] |
Public class methods
call
(env)
[show source]
# File lib/sinatra/base.rb, line 644 644: def call(env) 645: construct_middleware if @callsite.nil? 646: @callsite.call(env) 647: end
configure
(*envs) {|if envs.empty? || envs.include?(environment.to_sym)| ...}
[show source]
# File lib/sinatra/base.rb, line 618 618: def configure(*envs, &block) 619: yield if envs.empty? || envs.include?(environment.to_sym) 620: end
development?
()
[show source]
# File lib/sinatra/base.rb, line 614 614: def development? ; environment == :development ; end
new
(app=nil) {|self if block_given?| ...}
[show source]
# File lib/sinatra/base.rb, line 297 297: def initialize(app=nil) 298: @app = app 299: yield self if block_given? 300: end
production?
()
[show source]
# File lib/sinatra/base.rb, line 616 616: def production? ; environment == :production ; end
run!
(options={})
[show source]
# File lib/sinatra/base.rb, line 627 627: def run!(options={}) 628: set(options) 629: handler = Rack::Handler.get(server) 630: handler_name = handler.name.gsub(/.*::/, '') 631: puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " + 632: "on #{port} for #{environment} with backup from #{handler_name}" 633: handler.run self, :Host => host, :Port => port do |server| 634: trap(:INT) do 635: ## Use thins' hard #stop! if available, otherwise just #stop 636: server.respond_to?(:stop!) ? server.stop! : server.stop 637: puts "\n== Sinatra has ended his set (crowd applauds)" 638: end 639: end 640: rescue Errno::EADDRINUSE => e 641: puts "== Someone is already performing on port #{port}!" 642: end
test?
()
[show source]
# File lib/sinatra/base.rb, line 615 615: def test? ; environment == :test ; end
use
(middleware, *args, &block)
[show source]
# File lib/sinatra/base.rb, line 622 622: def use(middleware, *args, &block) 623: reset_middleware 624: @middleware << [middleware, args, block] 625: end
Public instance methods
call
(env)
[show source]
# File lib/sinatra/base.rb, line 302 302: def call(env) 303: dup.call!(env) 304: end
call!
(env)
[show source]
# File lib/sinatra/base.rb, line 308 308: def call!(env) 309: @env = env 310: @request = Request.new(env) 311: @response = Response.new 312: @params = nil 313: error_detection { dispatch! } 314: @response.finish 315: end
halt
(*response)
[show source]
# File lib/sinatra/base.rb, line 321 321: def halt(*response) 322: throw :halt, *response 323: end
options
()
[show source]
# File lib/sinatra/base.rb, line 317 317: def options 318: self.class 319: end