new

new() Class Public methods

instance_delegate

delegate method => accessordelegate [method, method, ...] => accessor Instance Public methods Takes a hash as its argument. The key is a symbol or an array of symbols. These symbols correspond to method names. The value is the accessor to which the methods will be delegated. delegate

delegate

delegate(hash) Instance Public methods Alias for: instance_delegate

def_instance_delegators

def_instance_delegators(accessor, *methods) Instance Public methods Shortcut for defining multiple delegator methods, but with no provision for using a different name. The following two code samples have the same effect: def_delegators :@records, :size, :<<, :map def_delegator :@records, :size def_delegator :@records, :<< def_delegator :@records, :map def_delegators

def_instance_delegator

def_instance_delegator(accessor, method, ali = method) Instance Public methods Define method as delegator instance method with an optional alias name ali. Method calls to ali will be delegated to accessor.method. class MyQueue extend Forwardable attr_reader :queue def initialize @queue = [] end def_delegator :@queue, :push, :mypush end q = MyQueue.new q.mypush 42 q.queue #=> [42] q.push 23 #=> NoMethodError def_delegator

def_delegators

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

def_delegator

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

quux

quux() Instance Public methods

hello

hello() Instance Public methods

foo

foo(n) Instance Public methods