Hi,

In message "how do i: add_observer( { small bit of code } )"
    on 02/03/13, mrp / cre.canon.co.uk <mrp / cre.canon.co.uk> writes:

|observing an object, i want to run a small bit of code when update is
|called.  i currently have a small class Wrapper, and set things up like:
|
|  x.add_observer( Wrapper.new() { my code }) 
|
|where the block parameter is stored in the class instance, and called in 
|Wrapper.update().
|
|is this the rubyest way of doing this?

How about using Proc?

  x.add_observer(lambda{ my code }) 

Then your observer can be called by "call".

							matz.