[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to monitor an Array's change?

Magicloud Magiclouds

1/10/2008 5:23:00 AM

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

Thanks.

2 Answers

Paul Stickney

1/10/2008 5:29:00 AM

0

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

Clifford Heath

1/10/2008 11:04:00 PM

0

Magicloud Magiclouds 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 Heath.