sinatra/lib
Blake Mizerany e20797047d passing a block to #pass will not 404, but eval the block
This is huge for writing extensions that install routes.
The developer can set the block to do default behaviour
if the app that registered the extension has not, or does
not want to, customize the route.

example:

  # MyFooExt
  ...
  def self.registered(app)
    app.get "/foo" do
      do_foo_things
      pass do
        "You hit foo!"
      end
    end
  end

At this point, as the user of MyFooExt, I can let the default
behaviour happen or override:

  # MySinatraApp
  require 'sinatra/my_foo_ext'

  class MySinatraApp < Sinatra::Base
    register MyFooExt

    get "/foo" do
      # MyFooExt has done do_foo_things
      do_our_foo_things
      "All foo things done"
    end
  end
2009-12-13 20:50:12 -08:00
..
sinatra passing a block to #pass will not 404, but eval the block 2009-12-13 20:50:12 -08:00
sinatra.rb Obsolete all deprecations: remove sinatra/compat.rb module 2009-06-05 21:58:56 -07:00