How to monitor an Array's change?

Hello,
Array under .net has some event on content changing. How to do monitor
like this in ruby?

Thanks.

You could proxy (via a true proxy or singletons or whatnot) for MOST
operations.

Magicloud M. wrote:

Array under .net has some event on content changing. How to do monitor
like this in ruby?

gem install chattr

allows you to define an array class having a type-checking
function that contains the hook you want. You can probably
ven replace the regular Array class with your new one. In
any case, all the mutating methods of Array make their calls
through the type-check block, so you have what you need.

Clifford H…

I believe you could also use trace_var

trace_var :$x, proc {print "The global variable $x is now ", $x, “\n”}