The SingleForwardable module provides delegation of specified methods to a designated object, using the methods #def_delegator and #def_delegators. This module is similar to Forwardable, but it works on objects themselves, instead of their defining classes.
Also see the example at forwardable.rb.
| Public Methods | |
|---|---|
| def_ |
Alias for #def_singleton_delegator |
| def_ |
Alias for #def_singleton_delegators |
| def_ |
Defines a method method which delegates to obj (i.e. it calls the method of the same name in obj). If new_name is provided, it is used as the name for the delegate method. |
| def_ |
Shortcut for defining multiple delegator methods, but with no provision for using a different name. The following two code samples have the same effect: |
<code/>and<pre/>for code samples.