Class: Dry::Monads::Do::MethodTracker Private

Inherits:
Module
  • Object
show all
Defined in:
lib/dry/monads/do.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(tracked_methods, base, wrapper) ⇒ MethodTracker

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MethodTracker.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/dry/monads/do.rb', line 32

def initialize(tracked_methods, base, wrapper)
  module_eval do
    private

    define_method(:method_added) do |method|
      super(method)

      if tracked_methods.include?(method)
        visibility = Do.method_visibility(base, method)
        Do.wrap_method(wrapper, method, visibility)
      end
    end
  end
end