diff --git a/README.md b/README.md
index ebfd04d5..77e952c5 100644
--- a/README.md
+++ b/README.md
@@ -348,24 +348,24 @@ Available Options:
locals
List of locals passed to the document. Handy with partials.
- Example: `erb "<%= foo %>", :locals => {:foo => "bar"}`
+ Example: erb "<%= foo %>", :locals => {:foo => "bar"}
default_encoding
String encoding to use if uncertain. Defaults to
- `settings.default_encoding`.
+ settings.default_encoding.
views
- Views folder to load templates from. Defaults to `settings.views`.
+ Views folder to load templates from. Defaults to settings.views.
layout
- Whether to use a layout (`true` or `false`), if it's a Symbol, specifies
- what template to use. Example: `erb :index, :layout => !request.xhr?`
+ Whether to use a layout (true or false), if it's a Symbol, specifies
+ what template to use. Example: erb :index, :layout => !request.xhr?
content_type
@@ -383,20 +383,19 @@ Available Options:
Template engine to use for rendering the layout. Useful for languages that
do not support layouts otherwise. Defaults to the engine used for the
- template. Example: `set :rdoc, :layout_engine => :erb`
+ template. Example: set :rdoc, :layout_engine => :erb
Templates are assumed to be located directly under the `./views`
directory. To use a different views directory:
+ set :views, settings.root + '/templates'
- set :views, settings.root + '/templates'
-
One important thing to remember is that you always have to reference
templates with symbols, even if they're in a subdirectory (in this
- case, use: `'subdir/template'`). You must use a symbol because
+ case, use: 'subdir/template'). You must use a symbol because
otherwise rendering methods will render any strings passed to them
directly.
@@ -441,11 +440,11 @@ to use (and to be thread-safe), you should simply require it first:
File Extensions |
- .erb , .rhtml or .erubis (Erubis only) |
+ .erb, .rhtml or .erubis (Erubis only) |
Example |
- erb :index |
+ erb :index |
@@ -460,11 +459,11 @@ to use (and to be thread-safe), you should simply require it first:
File Extension |
- .builder |
+ .builder |
Example |
- builder { |xml| xml.em "hi" } |
+ builder { |xml| xml.em "hi" } |
@@ -479,11 +478,11 @@ It also takes a block for inline templates (see example).
File Extension |
- .nokogiri |
+ .nokogiri |
Example |
- nokogiri { |xml| xml.e | m "hi" }
+ nokogiri { |xml| xml.e | m "hi" }
@@ -498,11 +497,11 @@ It also takes a block for inline templates (see example).
File Extension |
- .sass |
+ .sass |
Example |
- sass :stylesheet, :style => :expanded |
+ sass :stylesheet, :style => :expanded |
@@ -515,11 +514,11 @@ It also takes a block for inline templates (see example).
File Extension |
- .scss |
+ .scss |
Example |
- scss :stylesheet, :style => :expanded |
+ scss :stylesheet, :style => :expanded |
@@ -532,11 +531,11 @@ It also takes a block for inline templates (see example).
File Extension |
- .less |
+ .less |
Example |
- less :stylesheet |
+ less :stylesheet |
@@ -549,11 +548,11 @@ It also takes a block for inline templates (see example).
File Extension |
- .liquid |
+ .liquid |
Example |
- liquid :index, :locals => { :key => 'value' } |
+ liquid :index, :locals => { :key => 'value' } |
@@ -577,11 +576,11 @@ template, you almost always want to pass locals to it.
File Extensions |
- .markdown , .mkd and .md |
+ .markdown, .mkd and .md |
Example |
- markdown :index, :layout_engine => :erb |
+ markdown :index, :layout_engine => :erb |
@@ -613,11 +612,11 @@ template than for the layout by passing the `:layout_engine` option.
File Extension |
- .textile |
+ .textile |
Example |
- textile :index, :layout_engine => :erb |
+ textile :index, :layout_engine => :erb |
@@ -649,11 +648,11 @@ template than for the layout by passing the `:layout_engine` option.
File Extension |
- .rdoc |
+ .rdoc |
Example |
- rdoc :README, :layout_engine => :erb |
+ rdoc :README, :layout_engine => :erb |
@@ -684,11 +683,11 @@ template than for the layout by passing the `:layout_engine` option.
File Extension |
- .radius |
+ .radius |
Example |
- radius :index, :locals => { :key => 'value' } |
+ radius :index, :locals => { :key => 'value' } |
@@ -704,11 +703,11 @@ always want to pass locals to it.
File Extension |
- .mab |
+ .mab |
Example |
- markaby { h1 "Welcome!" } |
+ markaby { h1 "Welcome!" } |
@@ -723,11 +722,11 @@ It also takes a block for inline templates (see example).
File Extension |
- .rabl |
+ .rabl |
Example |
- rabl :index |
+ rabl :index |
@@ -740,11 +739,11 @@ It also takes a block for inline templates (see example).
File Extension |
- .slim |
+ .slim |
Example |
- slim :index |
+ slim :index |
@@ -757,11 +756,11 @@ It also takes a block for inline templates (see example).
File Extension |
- .creole |
+ .creole |
Example |
- creole :wiki, :layout_engine => :erb |
+ creole :wiki, :layout_engine => :erb |
@@ -799,11 +798,11 @@ template than for the layout by passing the `:layout_engine` option.
File Extension |
- .coffee |
+ .coffee |
Example |
- coffee :index |
+ coffee :index |
@@ -816,17 +815,17 @@ template than for the layout by passing the `:layout_engine` option.
File Extension |
- .yajl |
+ .yajl |
Example |
-
+
yajl :index,
:locals => { :key => 'qux' },
:callback => 'present',
:variable => 'resource'
-
+
|
@@ -855,11 +854,11 @@ The `:callback` and `:variable` options can be used to decorate the rendered obj
File Extension |
- .wlang |
+ .wlang |
Example |
- wlang :index, :locals => { :key => 'value' } |
+ wlang :index, :locals => { :key => 'value' } |
@@ -1547,8 +1546,8 @@ The options are:
disposition
- used for Content-Disposition, possible value: nil
(default),
- :attachment
and :inline
+ used for Content-Disposition, possible value: nil (default),
+ :attachment and :inline
length
@@ -1658,7 +1657,7 @@ similar classes:
```
This method is used internally by `expires`, `last_modified` and akin. You can
-therefore easily extend the behavior of those methods by overriding `time_fo`r
+therefore easily extend the behavior of those methods by overriding `time_for`
in your application:
```ruby
@@ -1814,39 +1813,36 @@ You can also hand in an array in order to disable a list of protections:
Enable if your app is running behind a reverse proxy that has not been set up
- properly. Note that the url
helper will still produce absolute URLs, unless you
- pass in false
as the second parameter.
+ properly. Note that the url helper will still produce absolute URLs, unless you
+ pass in false as the second parameter.
Disabled per default.
add_charsets
- mime types the content_type
helper will automatically add the charset info to.
+ mime types the content_type helper will automatically add the charset info to.
You should add to it rather than overriding this option:
+ settings.add_charsets << "application/foobar"
-
- settings.add_charsets << "application/foobar"
-
+ app_file
+
+ Path to the main application file, used to detect project root, views and public
+ folder and inline templates.
+
-app_file
-
- Path to the main application file, used to detect project root, views and public
- folder and inline templates.
-
+ bind
+ IP address to bind to (default: 0.0.0.0). Only used for built-in server.
-bind
-IP address to bind to (default: 0.0.0.0). Only used for built-in server.
-
-default_encoding
-encoding to assume if unknown (defaults to "utf-8"
).
+ default_encoding
+ encoding to assume if unknown (defaults to "utf-8").
dump_errors
display errors in the log.
environment
- current environment, defaults to ENV['RACK_ENV']
, or "development"
if
+ current environment, defaults to ENV['RACK_ENV'], or "development" if
not available.
@@ -1862,7 +1858,7 @@ You can also hand in an array in order to disable a list of protections:
method_override
- use _method
magic to allow put/delete forms in browsers that
+ use _method magic to allow put/delete forms in browsers that
don't support it.
@@ -1871,22 +1867,22 @@ You can also hand in an array in order to disable a list of protections:
prefixed_redirects
- Whether or not to insert request.script_name
into redirects if no
- absolute path is given. That way redirect '/foo'
would behave like
- redirect to('/foo')
. Disabled per default.
+ Whether or not to insert request.script_name into redirects if no
+ absolute path is given. That way redirect '/foo' would behave like
+ redirect to('/foo'). Disabled per default.
protection
Whether or not to enable web attack protections. See protection section above.
public_dir
- Alias for public_folder
. See below.
+ Alias for public_folder. See below.
public_folder
Path to the folder public files are served from. Only used if static
- file serving is enabled (see static
setting below). Inferred from
- app_file
setting if not set.
+ file serving is enabled (see static setting below). Inferred from
+ app_file setting if not set.
reload_templates
@@ -1896,13 +1892,13 @@ You can also hand in an array in order to disable a list of protections:
root
- Path to project root folder. Inferred from app_file
setting if not set.
+ Path to project root folder. Inferred from app_file setting if not set.
raise_errors
raise exceptions (will stop application). Enabled by default when
- environment
is set to "test"
, disabled otherwise.
+ environment is set to "test", disabled otherwise.
run
@@ -1922,18 +1918,18 @@ You can also hand in an array in order to disable a list of protections:
sessions
- Enable cookie-based sessions support using Rack::Session::Cookie
.
+ Enable cookie-based sessions support using Rack::Session::Cookie.
See 'Using Sessions' section for more information.
show_exceptions
Show a stack trace in the browser when an exception
- happens. Enabled by default when environment
- is set to "development"
, disabled otherwise.
+ happens. Enabled by default when environment
+ is set to "development", disabled otherwise.
- Can also be set to :after_handler
to trigger
+ Can also be set to :after_handler to trigger
app-specified error handling before showing a stack
trace in the browser.
@@ -1950,23 +1946,23 @@ You can also hand in an array in order to disable a list of protections:
static_cache_control
When Sinatra is serving static files, set this to add
- Cache-Control
headers to the responses. Uses the
- cache_control
helper. Disabled by default.
+ Cache-Control headers to the responses. Uses the
+ cache_control helper. Disabled by default.
Use an explicit array when setting multiple values:
- set :static_cache_control, [:public, :max_age => 300]
+ set :static_cache_control, [:public, :max_age => 300]
threaded
- If set to true
, will tell Thin to use EventMachine.defer
+ If set to true, will tell Thin to use EventMachine.defer
for processing the request.
views
- Path to the views folder. Inferred from app_filei
setting if
+ Path to the views folder. Inferred from app_file setting if
not set.
@@ -1987,7 +1983,7 @@ To run different environments use the `-e` option:
ruby my_app.rb -e [ENVIRONMENT]
```
-You can use predefined methods: +development?+, +test?+ and +production?+ to
+You can use predefined methods: `development?`, `test?` and `production?` to
check the current environment setting.
## Error Handling