Module: Rios::Easy

Included in:
Object
Defined in:
lib/rios/easy.rb

Constant Summary collapse

@@proxy =
Rios::Proxy.new

Class Method Summary collapse

Class Method Details

.delegate(*methods) ⇒ Object

Inspired from Sinatra



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

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