Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

SingleForwardable#delegate

(::Hash[::Symbol | ::Array[::Symbol], ::Symbol] hash) -> void
delegate method => accessor
delegate [method, method, ...] => accessor

Alias of #single_delegate

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.