Is a global variable defined inside a Sinatra route shared between requests?
问题 Say I've got: get '/' do $random = Random.rand() response.body = $random end If I have thousands of requests per second coming to /, will the $random be shared and 'leak' outside the context or will it act like a 'local' variable to the get block? I imagine if it was defined outside of the context of get '/' do it would indeed be shared but I wonder if there's a mechanic to $ in ruby that I'm not aware of. 回答1: This part of the Sinatra README about scope is always helpful to read but if you