Module: Dry::Monads::Do::All::InstanceMixin Private

Included in:
Dry::Monads::Do::All
Defined in:
lib/dry/monads/do/all.rb

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

Instance Method Summary collapse

Instance Method Details

#extended(object) ⇒ Object

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.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/dry/monads/do/all.rb', line 131

def extended(object)
  super

  wrapper = ::Module.new
  eigenclass = object.singleton_class
  eigenclass.prepend(wrapper)
  object.define_singleton_method(:singleton_method_added) do |method|
    super(method)

    next if method.equal?(:singleton_method_added)

    visibility = Do.method_visibility(eigenclass, method)
    Do.wrap_method(wrapper, method, visibility)
  end

  All.wrap_defined_methods(eigenclass, wrapper)
end