module Sinatra::Delegator
def self.delegate(*methods)
at the top-level.
methods to be delegated to the Sinatra::Application class. Used primarily
Sinatra delegation mixin. Mixing this module into an object causes all
def self.delegate(*methods) methods.each do |method_name| define_method(method_name) do |*args, &block| return super(*args, &block) if respond_to? method_name Delegator.target.send(method_name, *args, &block) end private method_name end end