class Dry::Effects::Providers::Implicit

Attributes

dictionary[R]

Public Instance Methods

call(dynamic = EMPTY_HASH) { || ... } click to toggle source

Yield the block with the handler installed

@api private

# File lib/dry/effects/providers/implicit.rb, line 24
def call(dynamic = EMPTY_HASH)
  if dynamic.empty?
    @dictionary = static
  else
    @dictionary = static.merge(dynamic)
  end

  yield
end
implicit(arg) click to toggle source
# File lib/dry/effects/providers/implicit.rb, line 17
def implicit(arg)
  dictionary.fetch(arg.class)
end
provide?(effect) click to toggle source

@param [Effect] effect @return [Boolean] @api public

Calls superclass method
# File lib/dry/effects/providers/implicit.rb, line 37
def provide?(effect)
  super &&
    dependency.equal?(effect.dependency) &&
    dictionary.key?(effect.payload[0].class)
end