instance method
Forwardable#delegate
(::Hash[::Symbol | ::Array[::Symbol], ::Symbol] hash) -> void
delegate method => accessor
delegate [method, method, ...] => accessor
lib/forwardable.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/forwardable.rb, line 135
def instance_delegate(hash)
hash.each do |methods, accessor|
unless defined?(methods.each)
def_instance_delegator(accessor, methods)
else
methods.each {|method| def_instance_delegator(accessor, method)}
end
end
end
Alias of #instance_delegate
Takes a hash as its argument. The key is a symbol or an array of symbols. These symbols correspond to method names, instance variable names, or constant names (see def_delegator). The value is the accessor to which the methods will be delegated.
See also
#instance_delegate
#def_instance_delegators
#def_instance_delegator
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0