Programming Ruby 3.2 (5th Edition): B4.0 page 593, delegated to the parameter class

@noelrappin

page 593 bottom, in the line before ref_meta_ruby/delegate_class.rb

pass the object to be delegated to the parameter class

is unclear (at least at first glance). I had to do some research. Without super

.../delegate.rb:405:in '__getobj__': not delegated (ArgumentError)

So calling super is crucial. I would say something like that :

In the new class’s initialize method, call super with the object to be delegated to the delegated class (the one given as parameter to DelegateClass).

or

In the new class’s initialize method, call super with the object to be delegated to the class given as parameter to DelegateClass.

or closer to your sentence :

In the new class’s initialize method, call super with the object to be delegated to this class (the parameter to DelegateClass).

How’s this:

“In the new class’s initialize method, call super with the object that is being delegated, which must be of the type passed in the class definition”

@noelrappin

This is clear. Thanks.