lib/synchronizable.rb in synchronizable-0.0.3 vs lib/synchronizable.rb in synchronizable-0.0.4
- old
+ new
@@ -14,14 +14,12 @@
# redefine all user-defined methods to utilize lock
obj.methods.each do |m|
original_method = obj.method(m)
next if IGNORABLE_METHOD_OWNERS.include?(original_method.owner)
- without_sync_method = "#{original_method.name}_without_sync"
- obj.define_singleton_method(without_sync_method, original_method)
obj.define_singleton_method(m) do |*args, &block|
__lock.synchronize do
- send(without_sync_method, *args, &block)
+ original_method.call(*args, &block)
end
end
end
# define synchronize method that executes a block