Class: Dry::Effects::Providers::Implicit
- Inherits:
-
Object
- Object
- Dry::Effects::Providers::Implicit
- Defined in:
- lib/dry/effects/providers/implicit.rb
Instance Attribute Summary collapse
-
#dictionary ⇒ Object
readonly
Returns the value of attribute dictionary.
Instance Method Summary collapse
-
#call(dynamic = EMPTY_HASH) ⇒ Object
private
Yield the block with the handler installed.
- #implicit(arg) ⇒ Object
- #provide?(effect) ⇒ Boolean
Instance Attribute Details
#dictionary ⇒ Object (readonly)
Returns the value of attribute dictionary.
13 14 15 |
# File 'lib/dry/effects/providers/implicit.rb', line 13 def dictionary @dictionary end |
Instance Method Details
#call(dynamic = EMPTY_HASH) ⇒ 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.
Yield the block with the handler installed
20 21 22 23 24 25 26 27 28 |
# File 'lib/dry/effects/providers/implicit.rb', line 20 def call(dynamic = EMPTY_HASH) if dynamic.empty? @dictionary = static else @dictionary = static.merge(dynamic) end yield end |
#implicit(arg) ⇒ Object
15 |
# File 'lib/dry/effects/providers/implicit.rb', line 15 def implicit(arg) = dictionary.fetch(arg.class) |
#provide?(effect) ⇒ Boolean
33 34 35 36 37 |
# File 'lib/dry/effects/providers/implicit.rb', line 33 def provide?(effect) super && dependency.equal?(effect.dependency) && dictionary.key?(effect.payload[0].class) end |