dry-effects 0.2.0 → 0.3.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 +10 -0
- data/LICENSE +1 -1
- data/README.md +4 -4
- data/dry-effects.gemspec +3 -3
- data/lib/dry/effects/effect.rb +0 -1
- data/lib/dry/effects/effects/async.rb +1 -1
- data/lib/dry/effects/effects/parallel.rb +1 -1
- data/lib/dry/effects/effects/resolve.rb +2 -2
- data/lib/dry/effects/errors.rb +1 -1
- data/lib/dry/effects/extensions/auto_inject.rb +2 -2
- data/lib/dry/effects/extensions/system.rb +4 -4
- data/lib/dry/effects/extensions.rb +0 -2
- data/lib/dry/effects/frame.rb +3 -10
- data/lib/dry/effects/halt.rb +0 -1
- data/lib/dry/effects/handler.rb +2 -10
- data/lib/dry/effects/initializer.rb +2 -2
- data/lib/dry/effects/instruction.rb +1 -1
- data/lib/dry/effects/provider/class_interface.rb +0 -1
- data/lib/dry/effects/providers/defer.rb +1 -1
- data/lib/dry/effects/providers/env.rb +1 -1
- data/lib/dry/effects/providers/lock.rb +1 -2
- data/lib/dry/effects/stack.rb +1 -1
- data/lib/dry/effects/version.rb +1 -1
- data/lib/dry/effects.rb +3 -3
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0239ad7c00317ef55c59d15f20b9445a23e4209ee381e6eb0e46300cca5615a4'
|
4
|
+
data.tar.gz: 25c49fe75fe6ada449943aa1642763acab11e20d91d66cd3ed0e5353ecf747b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 311d562013b53ed8e3744b2dd433ab5200313e17021ec8b9e3219d48d1ff31ddd824c537b8282be3647e90dd4045369229814f58782c13bd47be7374f9b48036
|
7
|
+
data.tar.gz: 7eac1b68843190d616057fdd61212ae46e70b3f88b21318daad6e1a5b9d6ea7d15ddbf32e0171095e16a8929d7d45d3661a4eb264629043cb3ae1a794ffc5da4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 0.3.0 2022-10-15
|
4
|
+
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
|
8
|
+
- Use zeitwerk for auto-loading (@flash-gordon)
|
9
|
+
- Remove dependency on dry-configurable (@flash-gordon)
|
10
|
+
|
11
|
+
[Compare v0.2.0...v0.3.0](https://github.com/dry-rb/dry-effects/compare/v0.2.0...v0.3.0)
|
12
|
+
|
3
13
|
## 0.2.0 2021-09-12
|
4
14
|
|
5
15
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -8,10 +8,10 @@
|
|
8
8
|
# dry-effects [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
|
9
9
|
|
10
10
|
[![Gem Version](https://badge.fury.io/rb/dry-effects.svg)][gem]
|
11
|
-
[![CI Status](https://github.com/dry-rb/dry-effects/workflows/
|
11
|
+
[![CI Status](https://github.com/dry-rb/dry-effects/workflows/ci/badge.svg)][actions]
|
12
12
|
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/158a8a584a3845eba4a67a71ad540210)][codacy]
|
13
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=
|
14
|
+
[![Inline docs](http://inch-ci.org/github/dry-rb/dry-effects.svg?branch=main)][inchpages]
|
15
15
|
|
16
16
|
## Links
|
17
17
|
|
@@ -22,8 +22,8 @@
|
|
22
22
|
|
23
23
|
This library officially supports the following Ruby versions:
|
24
24
|
|
25
|
-
* MRI `>= 2.
|
26
|
-
*
|
25
|
+
* MRI `>= 2.7.0`
|
26
|
+
* jruby `>= 9.3` (postponed until 2.7 is supported)
|
27
27
|
|
28
28
|
## License
|
29
29
|
|
data/dry-effects.gemspec
CHANGED
@@ -22,16 +22,16 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
24
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
25
|
-
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-effects/blob/
|
25
|
+
spec.metadata["changelog_uri"] = "https://github.com/dry-rb/dry-effects/blob/main/CHANGELOG.md"
|
26
26
|
spec.metadata["source_code_uri"] = "https://github.com/dry-rb/dry-effects"
|
27
27
|
spec.metadata["bug_tracker_uri"] = "https://github.com/dry-rb/dry-effects/issues"
|
28
28
|
|
29
|
-
spec.required_ruby_version = ">= 2.
|
29
|
+
spec.required_ruby_version = ">= 2.7.0"
|
30
30
|
|
31
31
|
# to update dependencies edit project.yml
|
32
32
|
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
33
33
|
spec.add_runtime_dependency "dry-container", "~> 0.7", ">= 0.7.2"
|
34
|
-
spec.add_runtime_dependency "dry-core", "~> 0.
|
34
|
+
spec.add_runtime_dependency "dry-core", "~> 0.9", ">= 0.9"
|
35
35
|
spec.add_runtime_dependency "dry-inflector", "~> 0.1", ">= 0.1.2"
|
36
36
|
spec.add_runtime_dependency "dry-initializer", "~> 3.0"
|
37
37
|
|
data/lib/dry/effects/effect.rb
CHANGED
@@ -13,12 +13,12 @@ module Dry
|
|
13
13
|
|
14
14
|
Resolve = Effect.new(type: :resolve)
|
15
15
|
|
16
|
-
Constructors.register(:Resolve) {
|
16
|
+
Constructors.register(:Resolve) { Resolve.(_1) }
|
17
17
|
|
18
18
|
def initialize(*keys, **aliases)
|
19
19
|
super()
|
20
20
|
|
21
|
-
keys_aliased = keys.map {
|
21
|
+
keys_aliased = keys.map { name_for(_1) }.zip(keys)
|
22
22
|
module_eval do
|
23
23
|
(keys_aliased + aliases.to_a).each do |name, key|
|
24
24
|
define_method(name) { |&block| ::Dry::Effects.yield(Resolve.(key), &block) }
|
data/lib/dry/effects/errors.rb
CHANGED
@@ -24,7 +24,7 @@ module Dry
|
|
24
24
|
class Static < Base
|
25
25
|
private
|
26
26
|
|
27
|
-
def define_readers(dynamic
|
27
|
+
def define_readers(dynamic: false)
|
28
28
|
map = dependency_map.to_h
|
29
29
|
cache = ::Concurrent::Map.new
|
30
30
|
instance_mod.class_exec do
|
@@ -49,7 +49,7 @@ module Dry
|
|
49
49
|
class Dynamic < Static
|
50
50
|
private
|
51
51
|
|
52
|
-
def define_readers(dynamic
|
52
|
+
def define_readers(dynamic: true)
|
53
53
|
super
|
54
54
|
end
|
55
55
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/system
|
3
|
+
require "dry/system"
|
4
4
|
|
5
5
|
Dry::Effects.load_extensions(:auto_inject)
|
6
6
|
|
@@ -10,7 +10,7 @@ module Dry
|
|
10
10
|
class AutoRegistrar < ::Dry::System::AutoRegistrar
|
11
11
|
# Always memoize and freeze registered components
|
12
12
|
def call(component_dir)
|
13
|
-
|
13
|
+
component_dir.each_component do |component|
|
14
14
|
next unless register_component?(component)
|
15
15
|
|
16
16
|
container.register(component.key, memoize: true) { component.instance.freeze }
|
@@ -19,7 +19,7 @@ module Dry
|
|
19
19
|
end
|
20
20
|
|
21
21
|
class Container < ::Dry::System::Container
|
22
|
-
|
22
|
+
setting :auto_registrar, default: AutoRegistrar
|
23
23
|
|
24
24
|
def self.injector(effects: true, **kwargs)
|
25
25
|
if effects
|
@@ -35,7 +35,7 @@ module Dry
|
|
35
35
|
super
|
36
36
|
|
37
37
|
# Force all components to load
|
38
|
-
each_key {
|
38
|
+
each_key { resolve(_1) }
|
39
39
|
self
|
40
40
|
end
|
41
41
|
end
|
data/lib/dry/effects/frame.rb
CHANGED
@@ -62,16 +62,9 @@ module Dry
|
|
62
62
|
|
63
63
|
private
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
fiber.raise(error)
|
69
|
-
end
|
70
|
-
else
|
71
|
-
# @api private
|
72
|
-
def raise_in_fiber(fiber, error)
|
73
|
-
fiber.resume(Instructions.Raise(error))
|
74
|
-
end
|
65
|
+
# @api private
|
66
|
+
def raise_in_fiber(fiber, error)
|
67
|
+
fiber.raise(error)
|
75
68
|
end
|
76
69
|
end
|
77
70
|
|
data/lib/dry/effects/halt.rb
CHANGED
data/lib/dry/effects/handler.rb
CHANGED
@@ -12,16 +12,8 @@ module Dry
|
|
12
12
|
@frame = Frame.new(provider)
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
def call(...)
|
18
|
-
frame.(...)
|
19
|
-
end
|
20
|
-
RUBY
|
21
|
-
else
|
22
|
-
def call(*args, &block)
|
23
|
-
frame.(*args, &block)
|
24
|
-
end
|
15
|
+
def call(...)
|
16
|
+
frame.(...)
|
25
17
|
end
|
26
18
|
|
27
19
|
def to_s
|
@@ -29,7 +29,7 @@ module Dry
|
|
29
29
|
def params_arity
|
30
30
|
@params_arity ||= dry_initializer
|
31
31
|
.definitions
|
32
|
-
.reject {
|
32
|
+
.reject { _2.option }
|
33
33
|
.size
|
34
34
|
end
|
35
35
|
|
@@ -44,7 +44,7 @@ module Dry
|
|
44
44
|
def __define_with__
|
45
45
|
seq_names = dry_initializer
|
46
46
|
.definitions
|
47
|
-
.reject {
|
47
|
+
.reject { _2.option }
|
48
48
|
.keys
|
49
49
|
.join(", ")
|
50
50
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core/equalizer"
|
4
3
|
require "dry/effects/provider"
|
5
4
|
require "dry/effects/initializer"
|
6
5
|
|
@@ -98,7 +97,7 @@ module Dry
|
|
98
97
|
with_backend(backend_replace) do
|
99
98
|
yield
|
100
99
|
ensure
|
101
|
-
owned.each {
|
100
|
+
owned.each { unlock(_1) }
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
data/lib/dry/effects/stack.rb
CHANGED
data/lib/dry/effects/version.rb
CHANGED
data/lib/dry/effects.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "dry/core
|
3
|
+
require "dry/core"
|
4
4
|
require "dry/effects/version"
|
5
5
|
require "dry/effects/container"
|
6
6
|
require "dry/effects/errors"
|
@@ -62,8 +62,8 @@ module Dry
|
|
62
62
|
# @param [Array<Object>] args Handler parameters
|
63
63
|
# @return [Handler]
|
64
64
|
# @api public
|
65
|
-
def [](
|
66
|
-
Handler.new(
|
65
|
+
def [](...)
|
66
|
+
Handler.new(...)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-effects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikita Shilnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -50,20 +50,20 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.9'
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '0.
|
56
|
+
version: '0.9'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0.
|
63
|
+
version: '0.9'
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0.
|
66
|
+
version: '0.9'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: dry-inflector
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,7 +216,7 @@ licenses:
|
|
216
216
|
- MIT
|
217
217
|
metadata:
|
218
218
|
allowed_push_host: https://rubygems.org
|
219
|
-
changelog_uri: https://github.com/dry-rb/dry-effects/blob/
|
219
|
+
changelog_uri: https://github.com/dry-rb/dry-effects/blob/main/CHANGELOG.md
|
220
220
|
source_code_uri: https://github.com/dry-rb/dry-effects
|
221
221
|
bug_tracker_uri: https://github.com/dry-rb/dry-effects/issues
|
222
222
|
post_install_message:
|
@@ -227,7 +227,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
227
|
requirements:
|
228
228
|
- - ">="
|
229
229
|
- !ruby/object:Gem::Version
|
230
|
-
version: 2.
|
230
|
+
version: 2.7.0
|
231
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
232
|
requirements:
|
233
233
|
- - ">="
|