Module: Sinatra::Delegator

Defined in:
lib/sinatra/base.rb

Overview

Sinatra delegation mixin. Mixing this module into an object causes all methods to be delegated to the Sinatra::Application class. Used primarily at the top-level.

Class Method Summary collapse

Class Method Details

.delegate(*methods) ⇒ Object

:nodoc:



1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
# File 'lib/sinatra/base.rb', line 1439

def self.delegate(*methods)
  methods.each do |method_name|
    eval <<-RUBY, binding, '(__DELEGATE__)', 1
      def #{method_name}(*args, &b)
        ::Sinatra::Application.send(#{method_name.inspect}, *args, &b)
      end
      private #{method_name.inspect}
    RUBY
  end
end