Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 10a1c7359e
Fetching contributors…

Cannot retrieve contributors at this time

117 lines (76 sloc) 3.04 kB
layout title
contrib
Sinatra::Contrib

Sinatra::Contrib

Starting with 1.3.0, every Sinatra release will be followed by a Sinatra::Contrib release which will include collection of common Sinatra extensions. Feel free to fork the source code and start contributing.

This extensions are organized in common and custom extensions. Common extensions will not add significant overhead or change any behavior of already existing APIs, and do not add any dependencies not already installed with Sinatra::Contrib. Custom extensions, on the other hand, may add additional dependencies and enhance the behavior of the existing APIs.

Usage

In Classic Style Applications

A single extension (example: sinatra-content-for):

require 'sinatra'
require 'sinatra/content_for'

Common extensions:

require 'sinatra'
require 'sinatra/contrib'

All extensions:

require 'sinatra'
require 'sinatra/contrib/all'

In Modular Style Applications

A single extension (example: sinatra-content-for and sinatra-namespace):

require 'sinatra/base'
require 'sinatra/content_for'
require 'sinatra/namespace'

class MyApp < Sinatra::Base
  # Note: Some modules are extensions, some helpers, see the specific
  # documentation or the source
  helpers Sinatra::ContentFor
  register Sinatra::Namespace
end

Common extensions:

require 'sinatra/base'
require 'sinatra/contrib'

class MyApp < Sinatra::Base
  register Sinatra::Contrib
end

All extensions:

require 'sinatra/base'
require 'sinatra/contrib'

class MyApp < Sinatra::Base
  register Sinatra::Contrib
end

What Is Included?

Common Extensions

Custom Extensions

  • Sinatra::Decompile: Recreates path patterns from Sinatra's internal data structures (used by other extensions).

  • Sinatra::Reloader: Automatically reloads Ruby files on code changes.

Other Tools

Jump to Line
Something went wrong with that request. Please try again.