dry-effects 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +57 -5
- data/LICENSE +1 -1
- data/README.md +19 -11
- data/dry-effects.gemspec +33 -41
- data/lib/dry/effects/all.rb +4 -4
- data/lib/dry/effects/container.rb +1 -1
- data/lib/dry/effects/effect.rb +2 -2
- data/lib/dry/effects/effects/async.rb +3 -1
- data/lib/dry/effects/effects/cache.rb +13 -9
- data/lib/dry/effects/effects/cmp.rb +3 -1
- data/lib/dry/effects/effects/current_time.rb +4 -2
- data/lib/dry/effects/effects/defer.rb +3 -1
- data/lib/dry/effects/effects/env.rb +4 -2
- data/lib/dry/effects/effects/fork.rb +3 -1
- data/lib/dry/effects/effects/implicit.rb +4 -2
- data/lib/dry/effects/effects/interrupt.rb +4 -2
- data/lib/dry/effects/effects/lock.rb +8 -6
- data/lib/dry/effects/effects/parallel.rb +4 -2
- data/lib/dry/effects/effects/random.rb +5 -3
- data/lib/dry/effects/effects/reader.rb +1 -1
- data/lib/dry/effects/effects/resolve.rb +23 -3
- data/lib/dry/effects/effects/retry.rb +4 -2
- data/lib/dry/effects/effects/state.rb +4 -2
- data/lib/dry/effects/effects/timeout.rb +3 -1
- data/lib/dry/effects/effects/timestamp.rb +3 -1
- data/lib/dry/effects/errors.rb +4 -4
- data/lib/dry/effects/extensions/active_support/tagged_logging.rb +13 -0
- data/lib/dry/effects/extensions/auto_inject.rb +5 -5
- data/lib/dry/effects/extensions/system.rb +8 -7
- data/lib/dry/effects/extensions.rb +12 -4
- data/lib/dry/effects/frame.rb +30 -9
- data/lib/dry/effects/halt.rb +3 -3
- data/lib/dry/effects/handler.rb +1 -1
- data/lib/dry/effects/inflector.rb +1 -1
- data/lib/dry/effects/initializer.rb +17 -16
- data/lib/dry/effects/instruction.rb +1 -1
- data/lib/dry/effects/instructions/execute.rb +2 -1
- data/lib/dry/effects/instructions/raise.rb +2 -1
- data/lib/dry/effects/provider/class_interface.rb +2 -2
- data/lib/dry/effects/provider.rb +2 -2
- data/lib/dry/effects/providers/async.rb +2 -2
- data/lib/dry/effects/providers/cache.rb +2 -2
- data/lib/dry/effects/providers/cmp.rb +1 -1
- data/lib/dry/effects/providers/current_time/time_generators.rb +1 -1
- data/lib/dry/effects/providers/current_time.rb +5 -5
- data/lib/dry/effects/providers/defer.rb +6 -6
- data/lib/dry/effects/providers/env.rb +2 -2
- data/lib/dry/effects/providers/fork.rb +2 -2
- data/lib/dry/effects/providers/implicit.rb +1 -1
- data/lib/dry/effects/providers/interrupt.rb +3 -3
- data/lib/dry/effects/providers/lock.rb +6 -8
- data/lib/dry/effects/providers/parallel.rb +3 -3
- data/lib/dry/effects/providers/random.rb +74 -2
- data/lib/dry/effects/providers/reader.rb +1 -1
- data/lib/dry/effects/providers/resolve.rb +8 -7
- data/lib/dry/effects/providers/retry.rb +5 -7
- data/lib/dry/effects/providers/state.rb +2 -2
- data/lib/dry/effects/providers/timeout.rb +2 -2
- data/lib/dry/effects/providers/timestamp.rb +2 -2
- data/lib/dry/effects/stack.rb +6 -6
- data/lib/dry/effects/version.rb +1 -1
- data/lib/dry/effects.rb +7 -7
- metadata +22 -69
- data/.codeclimate.yml +0 -12
- data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +0 -10
- data/.github/ISSUE_TEMPLATE/---bug-report.md +0 -30
- data/.github/ISSUE_TEMPLATE/---feature-request.md +0 -18
- data/.github/workflows/ci.yml +0 -74
- data/.github/workflows/docsite.yml +0 -34
- data/.github/workflows/sync_configs.yml +0 -34
- data/.gitignore +0 -12
- data/.rspec +0 -4
- data/.rubocop.yml +0 -95
- data/CODE_OF_CONDUCT.md +0 -13
- data/CONTRIBUTING.md +0 -29
- data/Gemfile +0 -23
- data/Rakefile +0 -8
- data/docsite/source/effects/cache.html.md +0 -84
- data/docsite/source/effects/current_time.html.md +0 -186
- data/docsite/source/effects/defer.html.md +0 -130
- data/docsite/source/effects/env.html.md +0 -144
- data/docsite/source/effects/interrupt.html.md +0 -109
- data/docsite/source/effects/parallel.html.md +0 -25
- data/docsite/source/effects/reader.html.md +0 -126
- data/docsite/source/effects/resolve.html.md +0 -188
- data/docsite/source/effects/state.html.md +0 -178
- data/docsite/source/effects/timeout.html.md +0 -42
- data/docsite/source/effects.html.md +0 -29
- data/docsite/source/index.html.md +0 -212
- data/examples/cmp.rb +0 -51
- data/examples/state.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80f0e1405c5ca987eb7f24a1ae3c71371f83595380ad49d04a61980767dbe06e
|
4
|
+
data.tar.gz: '028feb1018847ee3713b8a7cbad4572328d7b30f251889e5f58112fa7b25fa3e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c37d67a9030142e310e0df86d06fbdd63d21a3f3b52ea4f9f7792f9561e9ba48a58d50caad469bcfa4c30ef500b1d5772ebe4153001b65efd2390acb080a3ae
|
7
|
+
data.tar.gz: e4dc39c74bbb28a2ab0e79410752f0ceddff4bcd8d351b457c79dd608125c10709612ffb6c21c4b4b55714ad8a151a3c9d1ba93297931126f7c59f3e04d79d65
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,65 @@
|
|
1
|
-
|
1
|
+
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
-
##
|
3
|
+
## 0.2.0 2021-09-12
|
4
|
+
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
|
8
|
+
- Updated "system" extension to work with dry-system 0.19.0 (@timriley in #83)
|
9
|
+
|
10
|
+
[Compare v0.1.5...v0.2.0](https://github.com/dry-rb/dry-effects/compare/v0.1.5...v0.2.0)
|
11
|
+
|
12
|
+
## 0.1.5 2020-02-09
|
13
|
+
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- Add patch for ActiveRecord::TaggedLogger to preserve tags in presence of effect handlers (leehambley)
|
18
|
+
```ruby
|
19
|
+
Dry::Effects.load_extensions(:active_support_tagged_logging)
|
20
|
+
```
|
21
|
+
|
22
|
+
|
23
|
+
[Compare v0.1.4...v0.1.5](https://github.com/dry-rb/dry-effects/compare/v0.1.4...v0.1.5)
|
24
|
+
|
25
|
+
## 0.1.4 2020-01-07
|
26
|
+
|
27
|
+
|
28
|
+
### Fixed
|
29
|
+
|
30
|
+
- Some calls of effect builders were updated to prevent keyword warnings on 2.7 (flash-gordon)
|
31
|
+
|
32
|
+
|
33
|
+
[Compare v0.1.3...v0.1.4](https://github.com/dry-rb/dry-effects/compare/v0.1.3...v0.1.4)
|
34
|
+
|
35
|
+
## 0.1.3 2019-12-20
|
36
|
+
|
37
|
+
|
38
|
+
### Added
|
39
|
+
|
40
|
+
- Options for the random provider. You can pass a `seed` or a proc that will be used to generate random values. It is expected the value returned from the proc is within the `0.0...1.0` range (flash-gordon)
|
41
|
+
```ruby
|
42
|
+
with_random(seed: 123) { ... }
|
43
|
+
with_random(proc {|prev = 0.0| (prev + 0.1) % 1 }) { ... }
|
44
|
+
```
|
45
|
+
|
46
|
+
|
47
|
+
[Compare v0.1.2...v0.1.3](https://github.com/dry-rb/dry-effects/compare/v0.1.2...v0.1.3)
|
48
|
+
|
49
|
+
## 0.1.2 2019-12-15
|
50
|
+
|
51
|
+
|
52
|
+
### Fixed
|
4
53
|
|
5
54
|
- Keyword warnings issued by Ruby 2.7 (flash-gordon)
|
6
55
|
|
56
|
+
|
7
57
|
[Compare v0.1.1...v0.1.2](https://github.com/dry-rb/dry-effects/compare/v0.1.1...v0.1.2)
|
8
58
|
|
9
|
-
|
59
|
+
## 0.1.1 2019-11-30
|
10
60
|
|
11
|
-
|
61
|
+
|
62
|
+
### Added
|
12
63
|
|
13
64
|
- Extension for RSpec. Some features of RSpec require access to thread-local storage. This extension patches RSpec so that storage is shared between the root fiber and dry-effects context (flash-gordon)
|
14
65
|
|
@@ -19,8 +70,9 @@
|
|
19
70
|
Dry::Effects.load_extensions(:rspec)
|
20
71
|
```
|
21
72
|
|
73
|
+
|
22
74
|
[Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-effects/compare/v0.1.0...v0.1.1)
|
23
75
|
|
24
|
-
|
76
|
+
## 0.1.0 2019-09-28
|
25
77
|
|
26
78
|
Initial release.
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,22 +1,30 @@
|
|
1
|
+
<!--- this file is synced from dry-rb/template-gem project -->
|
1
2
|
[gem]: https://rubygems.org/gems/dry-effects
|
2
|
-
[
|
3
|
-
[
|
4
|
-
[coverage]: https://codeclimate.com/github/dry-rb/dry-effects/test_coverage
|
3
|
+
[actions]: https://github.com/dry-rb/dry-effects/actions
|
4
|
+
[codacy]: https://www.codacy.com/gh/dry-rb/dry-effects
|
5
5
|
[chat]: https://dry-rb.zulipchat.com
|
6
|
+
[inchpages]: http://inch-ci.org/github/dry-rb/dry-effects
|
6
7
|
|
7
8
|
# dry-effects [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
|
8
9
|
|
9
10
|
[![Gem Version](https://badge.fury.io/rb/dry-effects.svg)][gem]
|
10
|
-
[![
|
11
|
-
[![
|
12
|
-
[![
|
11
|
+
[![CI Status](https://github.com/dry-rb/dry-effects/workflows/CI/badge.svg)][actions]
|
12
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/158a8a584a3845eba4a67a71ad540210)][codacy]
|
13
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/158a8a584a3845eba4a67a71ad540210)][codacy]
|
14
|
+
[![Inline docs](http://inch-ci.org/github/dry-rb/dry-effects.svg?branch=master)][inchpages]
|
13
15
|
|
14
|
-
##
|
16
|
+
## Links
|
15
17
|
|
16
|
-
|
18
|
+
* [User documentation](https://dry-rb.org/gems/dry-effects)
|
19
|
+
* [API documentation](http://rubydoc.info/gems/dry-effects)
|
17
20
|
|
18
|
-
|
21
|
+
## Supported Ruby versions
|
19
22
|
|
20
|
-
|
23
|
+
This library officially supports the following Ruby versions:
|
21
24
|
|
22
|
-
|
25
|
+
* MRI `>= 2.6.0`
|
26
|
+
* ~~jruby~~ `>= 9.3` (we are waiting for [2.6 support](https://github.com/jruby/jruby/issues/6161))
|
27
|
+
|
28
|
+
## License
|
29
|
+
|
30
|
+
See `LICENSE` file.
|
data/dry-effects.gemspec
CHANGED
@@ -1,49 +1,41 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
# this file is synced from dry-rb/template-gem project
|
4
|
+
|
5
|
+
lib = File.expand_path("lib", __dir__)
|
4
6
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
7
|
+
require "dry/effects/version"
|
6
8
|
|
7
9
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name =
|
9
|
-
spec.
|
10
|
-
spec.
|
11
|
-
spec.
|
10
|
+
spec.name = "dry-effects"
|
11
|
+
spec.authors = ["Nikita Shilnikov"]
|
12
|
+
spec.email = ["fg@flashgordon.ru"]
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.version = Dry::Effects::VERSION.dup
|
12
15
|
|
13
|
-
spec.summary =
|
16
|
+
spec.summary = "Algebraic effects"
|
14
17
|
spec.description = spec.summary
|
15
|
-
spec.homepage =
|
16
|
-
spec.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
spec.
|
33
|
-
|
34
|
-
|
35
|
-
spec.
|
36
|
-
spec.
|
37
|
-
spec.
|
38
|
-
spec.required_ruby_version = '>= 2.4'
|
39
|
-
|
40
|
-
spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
|
41
|
-
spec.add_runtime_dependency 'dry-container', '~> 0.7', '>= 0.7.2'
|
42
|
-
spec.add_runtime_dependency 'dry-core', '~> 0.4', '>= 0.4.7'
|
43
|
-
spec.add_runtime_dependency 'dry-equalizer', '~> 0.2', '>= 0.2.2'
|
44
|
-
spec.add_runtime_dependency 'dry-inflector', '~> 0.1', '>= 0.1.2'
|
45
|
-
spec.add_runtime_dependency 'dry-initializer', '~> 3.0'
|
46
|
-
spec.add_development_dependency 'bundler'
|
47
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
48
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
18
|
+
spec.homepage = "https://dry-rb.org/gems/dry-effects"
|
19
|
+
spec.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "dry-effects.gemspec", "lib/**/*"]
|
20
|
+
spec.bindir = "bin"
|
21
|
+
spec.executables = []
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
25
|
+
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-effects/blob/master/CHANGELOG.md"
|
26
|
+
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-effects"
|
27
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-effects/issues"
|
28
|
+
|
29
|
+
spec.required_ruby_version = ">= 2.6.0"
|
30
|
+
|
31
|
+
# to update dependencies edit project.yml
|
32
|
+
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
33
|
+
spec.add_runtime_dependency "dry-container", "~> 0.7", ">= 0.7.2"
|
34
|
+
spec.add_runtime_dependency "dry-core", "~> 0.5", ">= 0.5"
|
35
|
+
spec.add_runtime_dependency "dry-inflector", "~> 0.1", ">= 0.1.2"
|
36
|
+
spec.add_runtime_dependency "dry-initializer", "~> 3.0"
|
37
|
+
|
38
|
+
spec.add_development_dependency "bundler"
|
39
|
+
spec.add_development_dependency "rake"
|
40
|
+
spec.add_development_dependency "rspec"
|
49
41
|
end
|
data/lib/dry/effects/all.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
3
|
+
require "concurrent/map"
|
4
|
+
require "dry/effects/inflector"
|
5
|
+
require "dry/effects/handler"
|
6
6
|
|
7
7
|
module Dry
|
8
8
|
module Effects
|
@@ -34,7 +34,7 @@ module Dry
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
if ::File.
|
37
|
+
if ::File.exist?("#{__dir__}/providers/#{key}.rb")
|
38
38
|
providers.register(key, memoize: true) do
|
39
39
|
require "dry/effects/providers/#{key}"
|
40
40
|
Providers.const_get(Inflector.camelize(key))
|
data/lib/dry/effects/effect.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/effects/effect"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module Effects
|
@@ -11,6 +11,8 @@ module Dry
|
|
11
11
|
Await = Effect.new(type: :async, name: :await)
|
12
12
|
|
13
13
|
def initialize
|
14
|
+
super
|
15
|
+
|
14
16
|
module_eval do
|
15
17
|
define_method(:async) { |&block| ::Dry::Effects.yield(Async.(block)) }
|
16
18
|
define_method(:await) { |task| ::Dry::Effects.yield(Await.(task)) }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/effects/effect"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module Effects
|
@@ -11,6 +11,8 @@ module Dry
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def initialize(scope = nil, shared: false, **kw)
|
14
|
+
super()
|
15
|
+
|
14
16
|
if !kw.empty?
|
15
17
|
scope, as = kw.to_a[0]
|
16
18
|
elsif scope.is_a?(::Hash)
|
@@ -25,16 +27,10 @@ module Dry
|
|
25
27
|
scope: scope
|
26
28
|
)
|
27
29
|
|
28
|
-
|
29
|
-
key = method(:shared_cache_key)
|
30
|
-
else
|
31
|
-
key = method(:cache_key)
|
32
|
-
end
|
33
|
-
|
34
|
-
methods = Array(as)
|
30
|
+
key = key(shared)
|
35
31
|
|
36
32
|
module_eval do
|
37
|
-
|
33
|
+
Array(as).each do |meth|
|
38
34
|
define_method(meth) do |*args, &block|
|
39
35
|
if block
|
40
36
|
eff = fetch_or_store.(key.(self, args), block)
|
@@ -48,6 +44,14 @@ module Dry
|
|
48
44
|
end
|
49
45
|
end
|
50
46
|
|
47
|
+
def key(shared)
|
48
|
+
if shared
|
49
|
+
method(:shared_cache_key)
|
50
|
+
else
|
51
|
+
method(:cache_key)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
51
55
|
def shared_cache_key(_, args, method: Undefined)
|
52
56
|
if Undefined.equal?(method)
|
53
57
|
args
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/effects/effect"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module Effects
|
@@ -11,6 +11,8 @@ module Dry
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def initialize(id)
|
14
|
+
super()
|
15
|
+
|
14
16
|
get = CmpEffect.new(type: :cmp, name: :get, id: id)
|
15
17
|
|
16
18
|
module_eval do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "dry/effects/effect"
|
4
|
+
require "dry/effects/constructors"
|
5
5
|
|
6
6
|
module Dry
|
7
7
|
module Effects
|
@@ -18,6 +18,8 @@ module Dry
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def initialize(**options)
|
21
|
+
super()
|
22
|
+
|
21
23
|
module_eval do
|
22
24
|
define_method(:current_time) do |opts = EMPTY_HASH|
|
23
25
|
round = opts.fetch(:round, Undefined)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/effects/effect"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module Effects
|
@@ -11,6 +11,8 @@ module Dry
|
|
11
11
|
Wait = Effect.new(type: :defer, name: :wait)
|
12
12
|
|
13
13
|
def initialize
|
14
|
+
super
|
15
|
+
|
14
16
|
module_eval do
|
15
17
|
define_method(:defer) do |executor: Undefined, &block|
|
16
18
|
::Dry::Effects.yield(Defer.(block, executor))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/effects/effect"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module Effects
|
@@ -9,6 +9,8 @@ module Dry
|
|
9
9
|
Read = Effect.new(type: :env, name: :read)
|
10
10
|
|
11
11
|
def initialize(*args, **kwargs)
|
12
|
+
super()
|
13
|
+
|
12
14
|
readers = args.zip(args) + kwargs.to_a
|
13
15
|
|
14
16
|
module_eval do
|
@@ -19,7 +21,7 @@ module Dry
|
|
19
21
|
else
|
20
22
|
readers.each do |reader, key|
|
21
23
|
define_method(reader) do
|
22
|
-
::Dry::Effects.yield(Read.(key))
|
24
|
+
::Dry::Effects.yield(Read.payload(key))
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/effects/effect"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module Effects
|
@@ -9,6 +9,8 @@ module Dry
|
|
9
9
|
Fork = Effect.new(type: :fork)
|
10
10
|
|
11
11
|
def initialize
|
12
|
+
super
|
13
|
+
|
12
14
|
module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
|
13
15
|
def fork
|
14
16
|
yield(::Dry::Effects.yield(Fork))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "dry/effects/effect"
|
4
4
|
|
5
5
|
module Dry
|
6
6
|
module Effects
|
@@ -11,11 +11,13 @@ module Dry
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def initialize(dependency)
|
14
|
+
super()
|
15
|
+
|
14
16
|
lookup = ImplicitEffect.new(type: :implicit, dependency: dependency)
|
15
17
|
|
16
18
|
module_eval do
|
17
19
|
define_method(dependency) do |*args|
|
18
|
-
::Dry::Effects.yield(lookup.(args[0])).(*args)
|
20
|
+
::Dry::Effects.yield(lookup.payload(args[0])).(*args)
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|