move check for gimp and firefox to when needed, to allow soft require
[booh] / lib / booh / Synchronizator.rb
index 192f6ca97ddf67c17524dd407614802ce56b9ba7..35bd115f044a377d0d8707a020a1fe50201fc769 100644 (file)
@@ -26,27 +26,28 @@ require 'monitor'
 
 class ObjectWrapper
     def initialize(wrapped_object)
-        @wrapped_object = wrapped_object
+        @__wrapped_object = wrapped_object
     end
     def method_missing(id, *args, &block)
-        wrap(id, *args, &block)
+        __wrap(id, *args, &block)
     end
-    def wrap(id, *args, &block)
+    def __wrap(id, *args, &block)
         if block.nil?
-            return @wrapped_object.__send__(id, *args)
+            return @__wrapped_object.__send__(id, *args)
         else
-            return @wrapped_object.__send__(id, *args) { |*args2| block.call(*args2) }
+            return @__wrapped_object.__send__(id, *args) { |*args2| block.call(*args2) }
         end
     end
 end
 
 class Synchronizator < ObjectWrapper
-    def initialize(wrapped_object)
-        super
-        @wrapped_object.extend(MonitorMixin)
+    def initialize(wrapped_object, monitor_object)
+        super(wrapped_object)
+        @__monitor_object = monitor_object
+        @__monitor_object.extend(MonitorMixin)
     end
-    def wrap(id, *args, &block)
-        @wrapped_object.synchronize {
+    def __wrap(id, *args, &block)
+        @__monitor_object.synchronize {
             super(id, *args, &block)
         }
     end