Module: Dry::Monads::Do::All
- Extended by:
- InstanceMixin
- Defined in:
- lib/dry/monads/do/all.rb
Overview
Do::All automatically wraps methods defined in a class with an unwrapping block.
Similar to what Do.for(...)
does except wraps every method so you don't have
to list them explicitly.
Defined Under Namespace
Modules: InstanceMixin Classes: MethodTracker
Class Method Summary collapse
- .included(base) ⇒ Object private
Methods included from InstanceMixin
Class Method Details
.included(base) ⇒ 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.
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/dry/monads/do/all.rb', line 99 def self.included(base) super 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(base, m) } base.extend(InstanceMixin) unless base.is_a?(::Class) end |