Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Some extensions to the sinatra default behavior (usefull for other Sintatra extensions, extracted from BigBand).
tree: 414483d916

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Basic Sinatra extension (mainly extending Sinatra's standard methods, like set or register). Also it features a more advanced path guessing than Sinatra::Base.

Normally you do not have to register this module manually, as the other extensions will do so if necessary.


Sinatra::Sugar is part of the BigBand stack. Check it out if you are looking for other fancy Sinatra extensions.

More advanced set

  • Adds set_#{key} and set_value hooks to set.
  • Merges the old value with the new one, if both are hashes:

    set :haml, :format => :html5, :escape_html => true set :haml, :excape_html => false haml # => { :format => :html5, :escape_html => false }

  • Allowes passing a block:

    set(:foo) { }

  • Defines a helper to access #{key} and #{key}? unless a helper/method with that name already exists.

More advanced register

If an exntesion is registered twice, the registered hook will only be called once.

Ability to extend command line options


require "sinatra" require "sinatra/sugar"

configure do run_option_parser.on("-i") { puts "yes, -i is a nice option" } end

Something went wrong with that request. Please try again.