Class: Yardcheck::Proxy

Inherits:
BasicObject
Defined in:
lib/yardcheck/proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ Proxy

Returns a new instance of Proxy.



5
6
7
# File 'lib/yardcheck/proxy.rb', line 5

def initialize(target)
  @target = target
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



13
14
15
16
17
18
19
20
21
22
# File 'lib/yardcheck/proxy.rb', line 13

def method_missing(method_name, *args, &block)
  if target_respond_to?(method_name)
    @target.__send__(method_name, *args, &block)
  else
    ::Object
      .instance_method(method_name)
      .bind(@target)
      .call(*args, &block)
  end
end