Tim Hunter wrote:
> Juozas Gaigalas wrote:
>> I'm looking for a simple and short solution/library that does this:
> (snip)
>> ----OUTPUT----
>> Array a changed
>> x
>> Array a changed
>> y
> 
> Check out the Observable class in the standard library.

Thanks for your prompt reply. Unfortunately Observable is not what I'm 
looking for. It requires manually setting "changed" state to true on 
every operation that modifies the array. I'm looking for something that 
overrides all of the methods that can modify an array (<<, pop, shift, 
push, []=, filter, etc.) then calls the old method and finally invokes 
the "modified" callback.

I'm assuming something like this exists (specifically for the Array 
class). I could write it myself, but I'd prefer to reuse existing code.




-- 
Posted via http://www.ruby-forum.com/.