Feature #4978 ยป 0001-lib-forwardable-Forwardable-instance_delegate-Single.patch
| lib/forwardable.rb | ||
|---|---|---|
|
#
|
||
|
def instance_delegate(hash)
|
||
|
hash.each{ |methods, accessor|
|
||
|
methods = [methods] unless methods.respond_to?(:each)
|
||
|
methods.each{ |method|
|
||
|
Array(methods).each{ |method|
|
||
|
def_instance_delegator(accessor, method)
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
#
|
||
|
def single_delegate(hash)
|
||
|
hash.each{ |methods, accessor|
|
||
|
methods = [methods] unless methods.respond_to?(:each)
|
||
|
methods.each{ |method|
|
||
|
Array(methods).each{ |method|
|
||
|
def_single_delegator(accessor, method)
|
||
|
}
|
||
|
}
|
||