lib/dry/monads/do/all.rb in dry-monads-1.0.1 vs lib/dry/monads/do/all.rb in dry-monads-1.1.0

- old
+ new

@@ -67,31 +67,38 @@ module_eval do define_method(:method_added) do |method| super(method) - tracker.wrap_method(method) + tracker.wrap_method(self, method) end + + define_method(:inherited) do |base| + super(base) + + base.prepend(wrappers[base]) + end end end def extend_object(target) super - target.prepend(wrappers) + target.prepend(wrappers[target]) end - def wrap_method(method) - Do.wrap_method(wrappers, method) + def wrap_method(target, method) + Do.wrap_method(wrappers[target], method) end end # @private def self.included(base) super - tracker = MethodTracker.new(Module.new) + wrappers = Hash.new { |h, k| h[k] = Module.new } + tracker = MethodTracker.new(wrappers) base.extend(tracker) - base.instance_methods(false).each { |m| tracker.wrap_method(m) } + base.instance_methods(false).each { |m| tracker.wrap_method(base, m) } end end end end end