From 683923b1c9dc53a180c85c8eb7e3f64fdc151e98 Mon Sep 17 00:00:00 2001 From: Mike Gehard Date: Sun, 30 Mar 2014 13:38:53 -0600 Subject: [PATCH] Add in info about subclassing Sinatra::Application This makes it more explicit for people that aren't familar with Sinatra --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e8f71198..c9d7b566 100644 --- a/README.md +++ b/README.md @@ -2452,7 +2452,20 @@ available via the top-level DSL. Most top-level apps can be converted to `Sinatra::Base` is a blank slate. Most options are disabled by default, including the built-in server. See [Configuring Settings](http://sinatra.github.com/configuration.html) -for details on available options and their behavior. +for details on available options and their behavior. If you want +behavior more similar to when you define your app at the top level (also +know as Classic style), you +can subclass `Sinatra::Application`. + +``` ruby +require 'sinatra/base' + +class MyApp < Sinatra::Application + get '/' do + 'Hello world!' + end +end +``` ### Modular vs. Classic Style @@ -2472,42 +2485,49 @@ different default settings: Setting Classic Modular + Modular app_file file loading sinatra file subclassing Sinatra::Base + file subclassing Sinatra::Application run $0 == app_file false + false logging true false + true method_override true false + true inline_templates true false + true static true false + true