Class: BlockProxy

Inherits:
Object show all
Defined in:
lib/proxy_block.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, method, *args) ⇒ BlockProxy

Returns a new instance of BlockProxy.



25
26
27
28
29
# File 'lib/proxy_block.rb', line 25

def initialize(target, method, *args)
  @target = target
  @method = method
  @args = args
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



35
36
37
# File 'lib/proxy_block.rb', line 35

def method_missing(method_name, *args, &block)
  proxy_target.send(proxy_method, *proxy_args){ proxy_target.send(method_name, *args, &block) }
end

Instance Method Details

#proxy_argsObject



33
# File 'lib/proxy_block.rb', line 33

def proxy_args;   @args;   end

#proxy_methodObject



32
# File 'lib/proxy_block.rb', line 32

def proxy_method; @method; end

#proxy_targetObject



31
# File 'lib/proxy_block.rb', line 31

def proxy_target; @target; end