From: Logan Capaldo Date: 2006-04-22T00:33:39+09:00 Subject: Re: Synchronized object On Apr 21, 2006, at 10:47 AM, Kroeger, Simon (ext) wrote: > Dear ruby-talk, > > is there a nice, concise way to lock each and > every method against all other methods of an object? > > To elaborate: I want to make sure that only one method of > a specific object (not class) can run at a each point in > time regardless of how many threads are using this object. > > I would hope there is module i just have to include in > my class definition. > > cheers and thanks > > Simon > Well it's not quite as easy as Java but: http://www.ruby-doc.org/stdlib/libdoc/monitor/rdoc/index.html obj.methods.each do |meth| (class << obj; self; end).module_eval <