Module: DelegateMethods

Included in:
MTProto::Client, MTProto::Transport::Connection
Defined in:
lib/mtproto/delegate_methods.rb

Instance Method Summary collapse

Instance Method Details

#delegate(*methods, to:) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/mtproto/delegate_methods.rb', line 4

def delegate(*methods, to:)
  methods.each do |method|
    define_method(method) do |*args, **kwargs, &block|
      instance_variable_get(:"@#{to}").public_send(method, *args, **kwargs, &block)
    end
  end
end