Class: SuperProxy
Overview
Simple class used in conjunction with custom method Object#sup
Instance Method Summary collapse
-
#initialize(obj) ⇒ SuperProxy
constructor
A new instance of SuperProxy.
- #method_missing(meth, *args, &blk) ⇒ Object
Constructor Details
#initialize(obj) ⇒ SuperProxy
Returns a new instance of SuperProxy.
5 6 7 |
# File 'lib/more_ruby/super_proxy.rb', line 5 def initialize(obj) @obj = obj end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
9 10 11 |
# File 'lib/more_ruby/super_proxy.rb', line 9 def method_missing(meth, *args, &blk) @obj.class.superclass.instance_method(meth).bind(@obj).call(*args, &blk) end |