Class: Sudo::MethodProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/sudo/proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(object, proxy) ⇒ MethodProxy

Returns a new instance of MethodProxy.



3
4
5
6
# File 'lib/sudo/proxy.rb', line 3

def initialize(object, proxy)
  @object = object
  @proxy = proxy
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method = :itself, *args, &blk) ⇒ Object



8
9
10
# File 'lib/sudo/proxy.rb', line 8

def method_missing(method = :itself, *args, &blk)
  @proxy.proxy @object, method, *args, &blk
end

Instance Method Details

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/sudo/proxy.rb', line 12

def respond_to_missing?(method, include_private = false)
  @object.respond_to?(method, include_private) || super
end