A new class is created for every request. However, this is not done by Rack. This is a feature of Sinatra.
If you want to dig into the details: The instance is not actually created with Sinatra::Application. New but with Sinatra::Application.prototype. Dup see Sinatra::Base#call for the code.
A new class is created for every request. However, this is not done by Rack. This is a feature of Sinatra.
If you want to dig into the details: The instance is not actually created with Sinatra::Application. New but with Sinatra::Application.prototype. Dup, see Sinatra::Base#call for the code.
So when no requests are being handled, Rack is just waiting for requests with one "empty" instance of Sinatra loaded. Then, when a request comes in, Rack tells this instance to duplicate and handle the request, did I got it right? – user562529 2 days ago actually it would make sense to add this info to sinatra documentation site – ʘleg yesterday.
A quick test shows that the same instance is running whatever the request (at least, by default). Require 'sinatra' flag = false get '/stuff' do puts "flag is #{flag? 'set' : 'unset'}" flag = true end When this code is run and two requests are received, the server will prompt flag is unset and then flag is unset.
EDIT: That shows the files are not reloaded. By using puts self. Object_id, self.
Class (as pguardiario recommended), we actually see that a new instance of Sinatra::Application is created for each request.
Maybe a better test would be: puts self. Object_id – pguardiario Nov 27 at 0:52 Well, it shows that the file is not reloaded as @Oleg said and you're right : with self. Object_id, we see that this is a different instance of Sinatra::Application for each request.
I'll edit my answer right now. – thoferon Nov 27 at 10:26.
Run this, you will know everything, but it dosen't mean the Rack mechanical of running as the Sinatra.(Actually, the Rack will creates a new instance for every request) require 'sinatra' configure do set :number, 0 end number = 0 get '/test1' do var = "The number is #{number}" number = number + 1 var end get '/test2' do var = "The number is #{settings. Number}" set :number, settings. Number + 1 var end.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.