D
Dave Lee
Hi all,
I have an each method where the value being yielded is an instance of
an Array subclass, created with rb_class_new_instance(argc, argv,
myClass). Clearly, the each method is being passed a block. My
problem is that my Array subclass basically calls super(size), which
sees the block given to my each method, and yields to it. This means
my each method is getting called an additional n times, where n is the
size of my array subclass instance. How can I hide, mask, or
temporarily remove the given block when I call the array constructor,
but still have it in place when my each method calls yield? I've
looked at the ruby source, but can't see anything obvious.
Thanks,
Dave
I have an each method where the value being yielded is an instance of
an Array subclass, created with rb_class_new_instance(argc, argv,
myClass). Clearly, the each method is being passed a block. My
problem is that my Array subclass basically calls super(size), which
sees the block given to my each method, and yields to it. This means
my each method is getting called an additional n times, where n is the
size of my array subclass instance. How can I hide, mask, or
temporarily remove the given block when I call the array constructor,
but still have it in place when my each method calls yield? I've
looked at the ruby source, but can't see anything obvious.
Thanks,
Dave