Module

SingleForwardable

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_delegator Alias for #def_singleton_delegator
def_delegators Alias for #def_singleton_delegators
def_singleton_delegator 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_singleton_delegators Shortcut for defining multiple delegator methods, but with no provision for using a different name. The following two code samples have the same effect:
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.