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:



1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
# File 'lib/sinatra/base.rb', line 1109

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