fix some typos in README.rdoc
This commit is contained in:
parent
c8ce7cdf4f
commit
210e342943
52
README.rdoc
52
README.rdoc
|
@ -146,9 +146,12 @@ also accepted.
|
|||
You can return any object that would either be a valid Rack response, Rack
|
||||
body object or HTTP status code:
|
||||
|
||||
* An Array with three elements: <tt>[status (Fixnum), headers (Hash), response body (responds to #each)]</tt>
|
||||
* An Array with two elements: <tt>[status (Fixnum), response body (responds to #each)]</tt>
|
||||
* An object that responds to <tt>#each</tt> and passes nothing but strings to the given block
|
||||
* An Array with three elements: <tt>[status (Fixnum), headers (Hash), response
|
||||
body (responds to #each)]</tt>
|
||||
* An Array with two elements: <tt>[status (Fixnum), response body (responds to
|
||||
#each)]</tt>
|
||||
* An object that responds to <tt>#each</tt> and passes nothing but strings to
|
||||
the given block
|
||||
* A Fixnum representing the status code
|
||||
|
||||
That way we can, for instance, easily implement a streaming example:
|
||||
|
@ -546,8 +549,9 @@ Templates may also be defined using the top-level <tt>template</tt> method:
|
|||
end
|
||||
|
||||
If a template named "layout" exists, it will be used each time a template
|
||||
is rendered. You can individually disable layouts by passing <tt>:layout => false</tt>
|
||||
or disable them by default via <tt>set :haml, :layout => false</tt>:
|
||||
is rendered. You can individually disable layouts by passing
|
||||
<tt>:layout => false</tt> or disable them by default via
|
||||
<tt>set :haml, :layout => false</tt>:
|
||||
|
||||
get '/' do
|
||||
haml :index, :layout => !request.xhr?
|
||||
|
@ -766,8 +770,8 @@ access the body:
|
|||
puts body
|
||||
end
|
||||
|
||||
It is also possible to pass a block to +body+, which will be executed by the Rack
|
||||
handler (this can be used to implement streaming, see "Return Values").
|
||||
It is also possible to pass a block to +body+, which will be executed by the
|
||||
Rack handler (this can be used to implement streaming, see "Return Values").
|
||||
|
||||
Similar to the body, you can also set the status code and headers:
|
||||
|
||||
|
@ -916,8 +920,8 @@ It is also possible to use a
|
|||
etag @article.sha1, :weak
|
||||
|
||||
These helpers will not do any caching for you, but rather feed the necessary
|
||||
information to your cache. If you are looking for a quick caching solutions, try
|
||||
{rack-cache}[http://rtomayko.github.com/rack-cache/]:
|
||||
information to your cache. If you are looking for a quick caching solutions,
|
||||
try {rack-cache}[http://rtomayko.github.com/rack-cache/]:
|
||||
|
||||
require "rack/cache"
|
||||
require "sinatra"
|
||||
|
@ -1169,8 +1173,8 @@ You can access those options via <tt>settings</tt>:
|
|||
|
||||
[port] Port to listen on. Only used for built-in server.
|
||||
|
||||
[prefixed_redirects] Whether or not to insert <tt>request.script_name</tt> into
|
||||
redirects if no absolute path is given. That way
|
||||
[prefixed_redirects] Whether or not to insert <tt>request.script_name</tt>
|
||||
into redirects if no absolute path is given. That way
|
||||
<tt>redirect '/foo'</tt> would behave like
|
||||
<tt>redirect to('/foo')</tt>. Disabled per default.
|
||||
|
||||
|
@ -1190,8 +1194,8 @@ You can access those options via <tt>settings</tt>:
|
|||
do not change this setting!
|
||||
|
||||
[server] server or list of servers to use for built-in server.
|
||||
defaults to ['thin', 'mongrel', 'webrick'], order indicates
|
||||
priority.
|
||||
defaults to ['thin', 'mongrel', 'webrick'], order
|
||||
indicates priority.
|
||||
|
||||
[sessions] enable cookie based sessions.
|
||||
|
||||
|
@ -1309,8 +1313,8 @@ with {CodeRack}[http://coderack.org/] or in the
|
|||
== Testing
|
||||
|
||||
Sinatra tests can be written using any Rack-based testing library
|
||||
or framework. {Rack::Test}[http://rdoc.info/github/brynary/rack-test/master/frames] is
|
||||
recommended:
|
||||
or framework. {Rack::Test}[http://rdoc.info/github/brynary/rack-test/master/frames]
|
||||
is recommended:
|
||||
|
||||
require 'my_sinatra_app'
|
||||
require 'test/unit'
|
||||
|
@ -1542,12 +1546,12 @@ available.
|
|||
|
||||
=== Application/Class Scope
|
||||
|
||||
Every Sinatra application corresponds to a subclass of <tt>Sinatra::Base</tt>. If you
|
||||
are using the top-level DSL (<tt>require 'sinatra'</tt>), then this class is
|
||||
<tt>Sinatra::Application</tt>, otherwise it is the subclass you created explicitly. At
|
||||
class level you have methods like +get+ or +before+, but you cannot access the
|
||||
+request+ object or the +session+, as there only is a single application class
|
||||
for all requests.
|
||||
Every Sinatra application corresponds to a subclass of <tt>Sinatra::Base</tt>.
|
||||
If you are using the top-level DSL (<tt>require 'sinatra'</tt>), then this
|
||||
class is <tt>Sinatra::Application</tt>, otherwise it is the subclass you
|
||||
created explicitly. At class level you have methods like +get+ or +before+, but
|
||||
you cannot access the +request+ object or the +session+, as there only is a
|
||||
single application class for all requests.
|
||||
|
||||
Options created via +set+ are methods at class level:
|
||||
|
||||
|
@ -1764,8 +1768,8 @@ SemVerTag.
|
|||
* {Mailing List}[http://groups.google.com/group/sinatrarb/topics]
|
||||
* {IRC: #sinatra}[irc://chat.freenode.net/#sinatra] on http://freenode.net
|
||||
* {Sinatra Book}[http://sinatra-book.gittr.com] Cookbook Tutorial
|
||||
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] Community contributed recipes
|
||||
* {Sinatra Book Contrib}[http://sinatra-book-contrib.com/] Community
|
||||
contributed recipes
|
||||
* API documentation for the {latest release}[http://rubydoc.info/gems/sinatra]
|
||||
or the {current HEAD}[http://rubydoc.info/github/sinatra/sinatra] on
|
||||
http://rubydoc.info/
|
||||
|
||||
http://rubydoc.info
|
||||
|
|
Loading…
Reference in New Issue