lib/ownership/global_methods.rb in ownership-0.1.0 vs lib/ownership/global_methods.rb in ownership-0.1.1

- old
+ new

@@ -1,7 +1,14 @@ module Ownership module GlobalMethods - def owner(owner, &block) + private + + def owner(*args, &block) + return super if is_a?(Method) # hack for pry + + owner = args[0] + # same error message as Ruby + raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 1)" if args.size != 1 raise ArgumentError, "Missing block" unless block_given? previous_value = Thread.current[:ownership_owner] begin Thread.current[:ownership_owner] = owner