Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update README

  • Loading branch information...
commit 7a4a66c46748020e438c910f9f2c44bc5a9be720 1 parent faa163f
@mynyml authored
Showing with 67 additions and 70 deletions.
  1. +1 −1  Manifest
  2. +0 −69 README
  3. +66 −0 README.md
View
2  Manifest
@@ -1,7 +1,7 @@
.gitignore
LICENSE
Manifest
-README
+README.md
Rakefile
TODO
docs.watchr
View
69 README
@@ -1,69 +0,0 @@
-===== Summary
-
-Rack convenience middleware that allows triggering different actions based on
-requested media type. Standalone version of the equivalent Rails functionality.
-
-RespondTo gets the requested media type from the Accept header, which contains
-a list of media types accepted/requested by the client, ordered by level of
-preference (see http://github.com/mynyml/rack-accept-media-types).
-
-===== Features
-
-* Based on familiar API (Rails)
-* Cascades down priority list of accepted media types
-* Handles wildcard media types
-* Simple to use
-* Simple code (~50 LOCs)
-* Flexible (standalone use)
-* Decently documented (examples/ dir, source docs/rdocs)
-* Compatible with other media type handling middleware (uses Rack::AcceptMediaTypes)
-
-===== Installation
-
- sudo gem install mynyml-rack-respond_to --source=http://gems.github.com/
-
-===== Example
-
- require 'rubygems'
- require 'rack'
- require 'rack/respond_to'
-
- class App
- include Rack::RespondTo
-
- def call(env)
- # Pass in the env, and RespondTo will retrieve the requested media types
- Rack::RespondTo.env = env
-
- # Alternatively, to use standalone you can also assign the media types
- # directly (this will take precedence over the env)
- #Rack::RespondTo.media_types = ['text/html']
-
- body = respond_to do |format|
- format.html { '<em>html</em>' }
- format.xml { '<body>xml</body>' }
- end
-
- [200, {'Content-Type' => Rack::RespondTo.selected_media_type}, [body]]
- end
- end
-
- run App.new
-
-See examples/simple_app.ru for an executable example.
-
-===== Tips
-
-Use together with Rack::AbstractFormat to respond to routes based on url
-extensions. For example, if you want <tt>example.com/foo.xml</tt> to trigger
-the <tt>format.xml</tt> block (Rack::AbstractFormat moves the extension's media
-type into HTTP_ACCEPT and makes it the highest ranked).
-
- sudo gem install mynyml-rack-abstract-format --source=http://gems.github.com/
-
-See examples/recommended_use.ru for a complete example.
-
-===== Links
-
-source:: http://github.com/mynyml/rack-respond_to
-rdocs:: http://docs.github.com/mynyml/rack-respond_to
View
66 README.md
@@ -0,0 +1,66 @@
+Summary
+-------
+Rack convenience middleware that allows triggering different actions based on
+requested media type. Standalone version of the equivalent Rails functionality.
+
+Features
+--------
+* Based on familiar API (Rails)
+* Cascades down priority list of accepted media types
+* Handles wildcard media types
+* Simple to use
+* Simple code (~50 LOCs)
+* Flexible (standalone use)
+* Decently documented (examples/ dir, source docs/rdocs)
+* Compatible with other media type handling middleware (uses Rack::AcceptMediaTypes)
+
+Install
+-------
+`gem install rack-respond_to`
+
+Example
+-------
+ require 'rack'
+ require 'rack/respond_to'
+
+ class App
+ include Rack::RespondTo #mixes in #respond_to
+
+ def call(env)
+ # Pass in the env, and RespondTo will retrieve the requested media types
+ Rack::RespondTo.env = env
+
+ # Alternatively, to use standalone you can also assign the media types
+ # directly (this will take precedence over the env)
+ #Rack::RespondTo.media_types = ['text/html']
+
+ body = respond_to do |format|
+ format.html { '<em>html</em>' }
+ format.xml { '<body>xml</body>' }
+ end
+
+ [200, {'Content-Type' => Rack::RespondTo.selected_media_type}, [body]]
+ end
+ end
+
+ run App.new
+
+See the examples/simple_app.ru for an executable example.
+
+Tips
+----
+Use together with `Rack::AbstractFormat` to respond to routes based on url
+extensions. For example, if you want `example.com/foo.xml` to trigger the
+`format.xml` block (`Rack::AbstractFormat` moves the extension's media type
+into `HTTP_ACCEPT` and makes it the highest ranked).
+
+ `gem install rack-abstract-format`
+
+See examples/recommended_use.ru for a complete example.
+
+Links
+-----
+
+* code: http://github.com/mynyml/rack-respond_to
+* docs: http://docs.github.com/mynyml/rack-respond_to
+* bugs: http://github.com/mynyml/rack-respond_to/issues
Please sign in to comment.
Something went wrong with that request. Please try again.