Type:
Module

SingleForwardable can be used to setup delegation at the object level as well.

printer = String.new
printer.extend SingleForwardable        # prepare object for delegation
printer.def_delegator "STDOUT", "puts"  # add delegation for STDOUT.puts()
printer.puts "Howdy!"

Also, SingleForwardable can be used to set up delegation for a Class or Module.

class Implementation
  def self.service
    puts "serviced!"
  end
end

module Facade
  extend SingleForwardable
  def_delegator :Implementation, :service
end

Facade.service #=> serviced!

If you want to use both Forwardable and SingleForwardable, you can use methods def_instance_delegator and #def_single_delegator, etc.

single_delegate

delegate method => accessordelegate [method, method, ...] => accessor Instance Public methods

2015-05-15 00:34:31
delegate

delegate(hash) Instance Public methods Alias for:

2015-05-15 00:31:31
def_delegator

def_delegator(accessor, method, ali = method) Instance Public methods Alias

2015-05-15 00:21:24
def_single_delegator

def_single_delegator(accessor, method, new_name=method) Instance Public methods Defines

2015-05-15 00:27:23
def_single_delegators

def_single_delegators(accessor, *methods) Instance Public methods Shortcut for

2015-05-15 00:30:01
def_delegators

def_delegators(accessor, *methods) Instance Public methods Alias for:

2015-05-15 00:26:31