Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
SingleForwardable#def_delegator
(::interned accessor, ::Symbol method, ?::Symbol ali) -> void
def_delegator(accessor, method, ali = method)
lib/forwardable.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/forwardable.rb, line 305
def def_single_delegator(accessor, method, ali = method)
gen = Forwardable._delegator_method(self, accessor, method, ali)
instance_eval(&gen)
end
Alias of #def_single_delegator
Defines a method method which delegates to accessor (i.e. it calls the method of the same name in accessor). If new_name is provided, it is used as the name for the delegate method. Returns the name of the method defined.