instance method
SingleForwardable#single_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 270
def single_delegate(hash)
hash.each do |methods, accessor|
unless defined?(methods.each)
def_single_delegator(accessor, methods)
else
methods.each {|method| def_single_delegator(accessor, method)}
end
end
end
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.