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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -5
  3. data/LICENSE +1 -1
  4. data/README.md +19 -11
  5. data/dry-effects.gemspec +33 -41
  6. data/lib/dry/effects/all.rb +4 -4
  7. data/lib/dry/effects/container.rb +1 -1
  8. data/lib/dry/effects/effect.rb +2 -2
  9. data/lib/dry/effects/effects/async.rb +3 -1
  10. data/lib/dry/effects/effects/cache.rb +13 -9
  11. data/lib/dry/effects/effects/cmp.rb +3 -1
  12. data/lib/dry/effects/effects/current_time.rb +4 -2
  13. data/lib/dry/effects/effects/defer.rb +3 -1
  14. data/lib/dry/effects/effects/env.rb +4 -2
  15. data/lib/dry/effects/effects/fork.rb +3 -1
  16. data/lib/dry/effects/effects/implicit.rb +4 -2
  17. data/lib/dry/effects/effects/interrupt.rb +4 -2
  18. data/lib/dry/effects/effects/lock.rb +8 -6
  19. data/lib/dry/effects/effects/parallel.rb +4 -2
  20. data/lib/dry/effects/effects/random.rb +5 -3
  21. data/lib/dry/effects/effects/reader.rb +1 -1
  22. data/lib/dry/effects/effects/resolve.rb +23 -3
  23. data/lib/dry/effects/effects/retry.rb +4 -2
  24. data/lib/dry/effects/effects/state.rb +4 -2
  25. data/lib/dry/effects/effects/timeout.rb +3 -1
  26. data/lib/dry/effects/effects/timestamp.rb +3 -1
  27. data/lib/dry/effects/errors.rb +4 -4
  28. data/lib/dry/effects/extensions/active_support/tagged_logging.rb +13 -0
  29. data/lib/dry/effects/extensions/auto_inject.rb +5 -5
  30. data/lib/dry/effects/extensions/system.rb +8 -7
  31. data/lib/dry/effects/extensions.rb +12 -4
  32. data/lib/dry/effects/frame.rb +30 -9
  33. data/lib/dry/effects/halt.rb +3 -3
  34. data/lib/dry/effects/handler.rb +1 -1
  35. data/lib/dry/effects/inflector.rb +1 -1
  36. data/lib/dry/effects/initializer.rb +17 -16
  37. data/lib/dry/effects/instruction.rb +1 -1
  38. data/lib/dry/effects/instructions/execute.rb +2 -1
  39. data/lib/dry/effects/instructions/raise.rb +2 -1
  40. data/lib/dry/effects/provider/class_interface.rb +2 -2
  41. data/lib/dry/effects/provider.rb +2 -2
  42. data/lib/dry/effects/providers/async.rb +2 -2
  43. data/lib/dry/effects/providers/cache.rb +2 -2
  44. data/lib/dry/effects/providers/cmp.rb +1 -1
  45. data/lib/dry/effects/providers/current_time/time_generators.rb +1 -1
  46. data/lib/dry/effects/providers/current_time.rb +5 -5
  47. data/lib/dry/effects/providers/defer.rb +6 -6
  48. data/lib/dry/effects/providers/env.rb +2 -2
  49. data/lib/dry/effects/providers/fork.rb +2 -2
  50. data/lib/dry/effects/providers/implicit.rb +1 -1
  51. data/lib/dry/effects/providers/interrupt.rb +3 -3
  52. data/lib/dry/effects/providers/lock.rb +6 -8
  53. data/lib/dry/effects/providers/parallel.rb +3 -3
  54. data/lib/dry/effects/providers/random.rb +74 -2
  55. data/lib/dry/effects/providers/reader.rb +1 -1
  56. data/lib/dry/effects/providers/resolve.rb +8 -7
  57. data/lib/dry/effects/providers/retry.rb +5 -7
  58. data/lib/dry/effects/providers/state.rb +2 -2
  59. data/lib/dry/effects/providers/timeout.rb +2 -2
  60. data/lib/dry/effects/providers/timestamp.rb +2 -2
  61. data/lib/dry/effects/stack.rb +6 -6
  62. data/lib/dry/effects/version.rb +1 -1
  63. data/lib/dry/effects.rb +7 -7
  64. metadata +22 -69
  65. data/.codeclimate.yml +0 -12
  66. data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +0 -10
  67. data/.github/ISSUE_TEMPLATE/---bug-report.md +0 -30
  68. data/.github/ISSUE_TEMPLATE/---feature-request.md +0 -18
  69. data/.github/workflows/ci.yml +0 -74
  70. data/.github/workflows/docsite.yml +0 -34
  71. data/.github/workflows/sync_configs.yml +0 -34
  72. data/.gitignore +0 -12
  73. data/.rspec +0 -4
  74. data/.rubocop.yml +0 -95
  75. data/CODE_OF_CONDUCT.md +0 -13
  76. data/CONTRIBUTING.md +0 -29
  77. data/Gemfile +0 -23
  78. data/Rakefile +0 -8
  79. data/docsite/source/effects/cache.html.md +0 -84
  80. data/docsite/source/effects/current_time.html.md +0 -186
  81. data/docsite/source/effects/defer.html.md +0 -130
  82. data/docsite/source/effects/env.html.md +0 -144
  83. data/docsite/source/effects/interrupt.html.md +0 -109
  84. data/docsite/source/effects/parallel.html.md +0 -25
  85. data/docsite/source/effects/reader.html.md +0 -126
  86. data/docsite/source/effects/resolve.html.md +0 -188
  87. data/docsite/source/effects/state.html.md +0 -178
  88. data/docsite/source/effects/timeout.html.md +0 -42
  89. data/docsite/source/effects.html.md +0 -29
  90. data/docsite/source/index.html.md +0 -212
  91. data/examples/cmp.rb +0 -51
  92. data/examples/state.rb +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b27bb0be01cba09f3ce2957a46f61c89ab25f3ff06cfc4ecea30b20ebaa9817
4
- data.tar.gz: d9066e6045bdf2c57f4102d17aefdd4733d4c97698740eafc463881f675770b7
3
+ metadata.gz: 80f0e1405c5ca987eb7f24a1ae3c71371f83595380ad49d04a61980767dbe06e
4
+ data.tar.gz: '028feb1018847ee3713b8a7cbad4572328d7b30f251889e5f58112fa7b25fa3e'
5
5
  SHA512:
6
- metadata.gz: 27e4ad1dbdb3dca88b20e8da65828060961319d1b16e21144c5361df94078018c5a2626ddc5387efe70cfc6e4d580da3c856ea703ba8b26be7c02d9943c8d579
7
- data.tar.gz: 1eb0f585c19f17cf75c9411a297e460107654af280b414bb9be582054de33e09117ff6d52b429cce0df221e7bb9dc6e90ee8df53a84536b26cf6b36186077a73
6
+ metadata.gz: 9c37d67a9030142e310e0df86d06fbdd63d21a3f3b52ea4f9f7792f9561e9ba48a58d50caad469bcfa4c30ef500b1d5772ebe4153001b65efd2390acb080a3ae
7
+ data.tar.gz: e4dc39c74bbb28a2ab0e79410752f0ceddff4bcd8d351b457c79dd608125c10709612ffb6c21c4b4b55714ad8a151a3c9d1ba93297931126f7c59f3e04d79d65
data/CHANGELOG.md CHANGED
@@ -1,14 +1,65 @@
1
- # v0.1.2 - 2019-12-15
1
+ <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
2
2
 
3
- ## Fixed
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
- # v0.1.1 - 2019-11-30
59
+ ## 0.1.1 2019-11-30
10
60
 
11
- ## Added
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
- # v0.1.0 - 2019-09-28
76
+ ## 0.1.0 2019-09-28
25
77
 
26
78
  Initial release.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2019 dry-rb team
3
+ Copyright (c) 2015-2021 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
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
- [ci]: https://github.com/dry-rb/dry-effects/actions?query=workflow%3Aci
3
- [codeclimate]: https://codeclimate.com/github/dry-rb/dry-effects/maintainability
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
- [![Build Status](https://github.com/dry-rb/dry-monads/workflows/ci/badge.svg)][ci]
11
- [![Maintainability](https://api.codeclimate.com/v1/badges/83bdab1ec9e1097c2284/maintainability)][codeclimate]
12
- [![Test Coverage](https://api.codeclimate.com/v1/badges/83bdab1ec9e1097c2284/test_coverage)][coverage]
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
- ## Development
16
+ ## Links
15
17
 
16
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
18
+ * [User documentation](https://dry-rb.org/gems/dry-effects)
19
+ * [API documentation](http://rubydoc.info/gems/dry-effects)
17
20
 
18
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
21
+ ## Supported Ruby versions
19
22
 
20
- ## Contributing
23
+ This library officially supports the following Ruby versions:
21
24
 
22
- See CONTRIBUTING.md.
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
- lib = File.expand_path('lib', __dir__)
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 'dry/effects/version'
7
+ require "dry/effects/version"
6
8
 
7
9
  Gem::Specification.new do |spec|
8
- spec.name = 'dry-effects'
9
- spec.version = Dry::Effects::VERSION
10
- spec.authors = ['Nikita Shilnikov']
11
- spec.email = ['fg@flashgordon.ru']
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 = 'Algebraic effects.'
16
+ spec.summary = "Algebraic effects"
14
17
  spec.description = spec.summary
15
- spec.homepage = 'https://github.com/dry-rb/dry-effects'
16
- spec.license = 'MIT'
17
-
18
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
- # to allow pushing to a single host or delete this section to allow pushing to any host.
20
- if spec.respond_to?(:metadata)
21
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
22
- spec.metadata['homepage_uri'] = spec.homepage
23
- spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-effects'
24
- spec.metadata['bug_tracker_uri'] = 'https://github.com/dry-rb/dry-effects/issues'
25
- else
26
- raise 'RubyGems 2.0 or newer is required to protect against ' \
27
- 'public gem pushes.'
28
- end
29
-
30
- # Specify which files should be added to the gem when it is released.
31
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
33
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
34
- end
35
- spec.bindir = 'exe'
36
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
- spec.require_paths = ['lib']
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
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'concurrent/map'
4
- require 'dry/effects/inflector'
5
- require 'dry/effects/handler'
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.exists?("#{__dir__}/providers/#{key}.rb")
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))
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/container'
3
+ require "dry/container"
4
4
 
5
5
  module Dry
6
6
  module Effects
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/equalizer'
4
- require 'dry/effects/initializer'
3
+ require "dry/core/equalizer"
4
+ require "dry/effects/initializer"
5
5
 
6
6
  module Dry
7
7
  module Effects
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dry/effects/effect'
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 'dry/effects/effect'
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
- if shared
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
- methods.each do |meth|
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 'dry/effects/effect'
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 'dry/effects/effect'
4
- require 'dry/effects/constructors'
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 'dry/effects/effect'
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 'dry/effects/effect'
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 'dry/effects/effect'
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 'dry/effects/effect'
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