1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Merge pull request #858 from msgehard/sinatra_application_mentions

Add in info about subclassing Sinatra::Application
This commit is contained in:
Konstantin Haase 2014-04-01 18:58:03 +02:00
commit ab377da110

View file

@ -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:
<th>Setting</th>
<th>Classic</th>
<th>Modular</th>
<th>Modular</th>
</tr>
<tr>
<td>app_file</td>
<td>file loading sinatra</td>
<td>file subclassing Sinatra::Base</td>
<td>file subclassing Sinatra::Application</td>
</tr>
<tr>
<td>run</td>
<td>$0 == app_file</td>
<td>false</td>
<td>false</td>
</tr>
<tr>
<td>logging</td>
<td>true</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>method_override</td>
<td>true</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>inline_templates</td>
<td>true</td>
<td>false</td>
<td>true</td>
</tr>
<tr>
<td>static</td>
<td>true</td>
<td>false</td>
<td>true</td>
</tr>
</table>