Module: Martin::Delegator

Defined in:
lib/martin/delegator.rb

Overview

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

92% ripped from Sinatra::Delegator

Class Method Summary collapse

Class Method Details

.delegate(mod, *methods) ⇒ Object

:nodoc:



8
9
10
11
12
13
14
15
16
17
# File 'lib/martin/delegator.rb', line 8

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