Patrick Gundlach wrote:
> [...]
>
>>> class ENC < DelegateClass(Array)
>>>   ...
>>> end
>>
>> Yep.
>
> Great, that works fine with all my tests :) Somehow I was always
> afraid of delegate.rb. Don't ask me why, perhaps mostly because it is
> not shipped with lots of examples where it shows its advantage over
> other approaches (in my case: subclassing Array directly).
>
>> Or do it selectively (what I'd prefer).
>
> I use my class to build a library. So I don't know in advance what
> methods the users would like use. So is there a warning attached to
> the above?

Well, you as the lib provider have to decide on the public interface of
your lib.  If you just unconditionally make internals available you might
discover that someone did something to your object that neither foresaw
nor supported.  I know too few about your case but I'm inclined to do the
forwarding selectively or even manually as a general rule of thumb.  You
create the type so it's up to you to decide on the interface.  Extending
it later is usually easier than removing public methods.

Kind regards

    robert