Ruby web app lifecycle

I am interesting in some manual/tutorial which I could not find.

What is a lifecycle of Ruby Web application? Ruby is a scripting language. Same as PHP. But as I heard, Ruby is precompiled before running. So the questions are:

  • when precompilation is done?
  • how precompilation is working for different files and classes?
  • what is a lifetime of precompiled code?
  • how route is passed to ruby application from apache/nginx (example could be made based on sinatra)?
  • maybe there is a tutorial on how to make own simple web framework, or web page without any web frameworks, but with pure ruby.
  • where is session object located?
  • etc.

Every manual contains only information on how to use some framework, but how it is working internally, nothing is describing this.

Thank you.


Ruby is "interpreted" just as PHP is, but this is also a form of compilation. What you might be confusing is that Ruby on Rails and Sinatra, as with most Ruby-based frameworks, are hosted as persistent processes. PHP tends to be interpreted for each request, though accelerators and web server modules do reduce the overhead of this process significantly.

I wouldn't suggest trying to make your own framework as this is a non-trivial task and even as an academic exercise would be of limited value. It's best to study something like Sinatra to see how that's implemented in order to learn more than to start from scratch.

Rails is quite well documented. If you have a specific question about a component of the framework that can't be answered by simply reading the source code, which is usually fairly well organized, you can post that here.

Need Your Help

How can I transform a Map to a case class in Scala?

class scala map case

If I have a Map[String,String]("url" -> "xxx", "title" -> "yyy"), is there an way to generically transform it into a case class Image(url:String, title:String)?

Better way to read last portion of URL

php string url search url-parsing

This script should detect the last portion in the full path, and if it is stackoverflow output ok

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.