From: Sean O'Dell Date: 2004-07-10T06:32:04+09:00 Subject: Re: Proc Blocks, passing them around...question. On Friday 09 July 2004 14:01, Zach Dennis wrote: > Take the following code (this is conceptual thought, not working code): > > class MyObject > def initialize > @myobj = MyEventHandler.new(); > @myobj.event(){ |evt| > puts( evt.getID() ); } > end > end > > m = MyObject.new(); > > > I would like to get rid of the { |evt| ... } block and instead pass in a > proc created by an outside method. I would like to do this to clean up my > code because my proc is of decent size. Any ideas? Thanks, Something like this: class MyObject def initialize(&handler) @myobj = MyEventHandler.new(); @myobj.event(handler) end end handler = proc { |evt| puts( evt.getID() ); } m = MyObject.new(handler); Sean O'Dell