Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improve Sinatra::LinkHeader docs

  • Loading branch information...
commit 8e9eee9c54953cba2c287de87feb7eee9c524990 1 parent 7d1f23c
Gabriel Andretta gnandretta authored
Showing with 50 additions and 2 deletions.
  1. +50 −2 lib/sinatra/link_header.rb
52 lib/sinatra/link_header.rb
View
@@ -1,8 +1,56 @@
require 'sinatra/base'
module Sinatra
- ##
- # Helper methods for generating Link HTTP headers and HTML tags.
+
+ # = Sinatra::LinkHeader
+ #
+ # <tt>Sinatra::LinkHeader</tt> adds a set of helper methods to generate link
+ # HTML tags and their corresponding Link HTTP headers.
+ #
+ # == Usage
+ #
+ # Once you had set up the helpers in your application (see below), you will
+ # be able to call the following methods from inside your route handlers,
+ # filters and templates:
+ #
+ # +prefetch+::
+ # Sets the Link HTTP headers and returns HTML tags to prefetch the given
+ # resources.
+ #
+ # +stylesheet+::
+ # Sets the Link HTTP headers and returns HTML tags to use the given
+ # stylesheets.
+ #
+ # +link+::
+ # Sets the Link HTTP headers and returns the corresponding HTML tags
+ # for the given resources.
+ #
+ # +link_headers+::
+ # Returns the corresponding HTML tags for the current Link HTTP headers.
+ #
+ # === Classic Application
+ #
+ # In a classic application simply require the helpers, and start using them:
+ #
+ # require "sinatra"
+ # require "sinatra/link_header"
+ #
+ # # The rest of your classic application code goes here...
+ #
+ # === Modular Application
+ #
+ # In a modular application you need to require the helpers, and then tell
+ # the application you will use them:
+ #
+ # require "sinatra/base"
+ # require "sinatra/link_header"
+ #
+ # class MyApp < Sinatra::Base
+ # helpers Sinatra::LinkHeader
+ #
+ # # The rest of your modular application code goes here...
+ # end
+ #
module LinkHeader
##
# Set Link HTTP header and returns HTML tags for telling the browser to
Please sign in to comment.
Something went wrong with that request. Please try again.