3 # A.k.a `Best web-album Of the world, Or your money back, Humerus'.
5 # The acronyn sucks, however this is a tribute to Dragon Ball by
6 # Akira Toriyama, where the last enemy beaten by heroes of Dragon
7 # Ball is named "Boo". But there was already a free software project
8 # called Boo, so this one will be it "Booh". Or whatever.
11 # Copyright (c) 2004 Guillaume Cottenceau <gc3 at bluewin.ch>
13 # This software may be freely redistributed under the terms of the GNU
14 # public license version 2.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 # Any method call to the wrapped object will be synchronized on a unique
22 # monitor. Recursive calls are possible.
28 def initialize(wrapped_object)
29 @wrapped_object = wrapped_object
31 def method_missing(id, *args, &block)
32 wrap(id, *args, &block)
34 def wrap(id, *args, &block)
36 return @wrapped_object.__send__(id, *args)
38 return @wrapped_object.__send__(id, *args) { |*args2| block.call(*args2) }
43 class Synchronizator < ObjectWrapper
44 def initialize(wrapped_object)
46 @wrapped_object.extend(MonitorMixin)
48 def wrap(id, *args, &block)
49 @wrapped_object.synchronize {
50 super(id, *args, &block)