Class: Sudo::MethodProxy
- Inherits:
-
Object
- Object
- Sudo::MethodProxy
- Defined in:
- lib/sudo/proxy.rb
Instance Method Summary collapse
-
#initialize(object, proxy) ⇒ MethodProxy
constructor
A new instance of MethodProxy.
- #method_missing(method = :itself, *args, &blk) ⇒ Object
- #respond_to_missing?(method, include_private = false) ⇒ Boolean
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
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 |