lib/ownership/global_methods.rb in ownership-0.2.0 vs lib/ownership/global_methods.rb in ownership-0.3.0
- old
+ new
@@ -12,20 +12,18 @@
previous_value = Thread.current[:ownership_owner]
begin
Thread.current[:ownership_owner] = owner
- begin
- # callbacks
- if Ownership.around_change
- Ownership.around_change.call(owner, block)
- else
- block.call
- end
- rescue Exception => e
- e.owner ||= owner
- raise
+ # callbacks
+ if Ownership.around_change
+ Ownership.around_change.call(owner, block)
+ else
+ block.call
end
+ rescue Exception => e
+ e.owner ||= owner
+ raise
ensure
Thread.current[:ownership_owner] = previous_value
end
end
end