e20797047d
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 |
||
---|---|---|
.. | ||
sinatra | ||
sinatra.rb |