dry-effects 0.3.1 → 0.4.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 +9 -0
- data/dry-effects.gemspec +3 -3
- data/lib/dry/effects/constructors.rb +2 -2
- data/lib/dry/effects/container.rb +1 -1
- data/lib/dry/effects/errors.rb +4 -4
- data/lib/dry/effects/extensions/auto_inject.rb +7 -2
- data/lib/dry/effects/version.rb +1 -1
- data/lib/dry/effects.rb +1 -2
- data/lib/dry-effects.rb +2 -0
- metadata +14 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4689f958a2a85578e4e0a3bd536ab47c85537df6782a4e48c9c306c425c7b968
|
4
|
+
data.tar.gz: bbcbd08b72281a805c47ea40c75250aedbc755b667e33d9839f51bbb6b7a4658
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d9a9ec37dff625b770b21a24a10c4ae663bea543b5c9924dc9b4280cfb234b69639dcf82947e53842577aba8a7e93911db938054efa73800480c3ae27185ae5
|
7
|
+
data.tar.gz: 844c22f024a56801cf5e351f2e1540d353e570ee7e5b26b94e94e53467605d122408444c32a196fd6c9b773c4d7cdfaaff8c0051d8ca39f4a7c4729d7fa58916
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
<!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
|
2
2
|
|
3
|
+
## 0.4.0
|
4
|
+
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
|
8
|
+
- This version is compatible with recently released dry-rb dependencies (@flash-gordon)
|
9
|
+
|
10
|
+
[Compare v0.3.1...main](https://github.com/dry-rb/dry-effects/compare/v0.3.1...main)
|
11
|
+
|
3
12
|
## 0.3.1 2022-10-17
|
4
13
|
|
5
14
|
|
data/dry-effects.gemspec
CHANGED
@@ -30,10 +30,10 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
# to update dependencies edit project.yml
|
32
32
|
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
|
33
|
-
spec.add_runtime_dependency "dry-
|
34
|
-
spec.add_runtime_dependency "dry-
|
35
|
-
spec.add_runtime_dependency "dry-inflector", "~> 0.1", ">= 0.1.2"
|
33
|
+
spec.add_runtime_dependency "dry-core", "~> 1.0"
|
34
|
+
spec.add_runtime_dependency "dry-inflector", "~> 1.0"
|
36
35
|
spec.add_runtime_dependency "dry-initializer", "~> 3.0"
|
36
|
+
spec.add_runtime_dependency "zeitwerk", "~> 2.6"
|
37
37
|
|
38
38
|
spec.add_development_dependency "bundler"
|
39
39
|
spec.add_development_dependency "rake"
|
@@ -3,8 +3,6 @@
|
|
3
3
|
module Dry
|
4
4
|
module Effects
|
5
5
|
module Constructors
|
6
|
-
extend self
|
7
|
-
|
8
6
|
# @api public
|
9
7
|
def CurrentTime(**kwargs)
|
10
8
|
if kwargs.empty?
|
@@ -33,6 +31,8 @@ module Dry
|
|
33
31
|
def Write(scope, value)
|
34
32
|
Effects::State::State.new(type: :state, name: :write, scope: scope, payload: [value])
|
35
33
|
end
|
34
|
+
|
35
|
+
instance_methods(false).each { module_function(_1) }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/dry/effects/errors.rb
CHANGED
@@ -19,7 +19,7 @@ module Dry
|
|
19
19
|
|
20
20
|
super(
|
21
21
|
Undefined.default(message) {
|
22
|
-
"Effect #{effect.inspect} not handled. "\
|
22
|
+
"Effect #{effect.inspect} not handled. " \
|
23
23
|
"Effects must be wrapped with corresponding handlers"
|
24
24
|
}
|
25
25
|
)
|
@@ -31,7 +31,7 @@ module Dry
|
|
31
31
|
# @api private
|
32
32
|
class MissingStateError < UnhandledEffectError
|
33
33
|
def initialize(effect)
|
34
|
-
message = "Value of +#{effect.scope}+ is not set, "\
|
34
|
+
message = "Value of +#{effect.scope}+ is not set, " \
|
35
35
|
"you need to provide value with an effect handler"
|
36
36
|
|
37
37
|
super(effect, message)
|
@@ -45,8 +45,8 @@ module Dry
|
|
45
45
|
include Error
|
46
46
|
|
47
47
|
def initialize(effect)
|
48
|
-
message = "+#{effect.scope}+ is not defined, you need to assign it first "\
|
49
|
-
"by using a writer, passing initial value to the handler, or "\
|
48
|
+
message = "+#{effect.scope}+ is not defined, you need to assign it first " \
|
49
|
+
"by using a writer, passing initial value to the handler, or " \
|
50
50
|
"providing a fallback value"
|
51
51
|
|
52
52
|
super(message)
|
@@ -1,12 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "concurrent/map"
|
4
|
-
require "dry/auto_inject
|
4
|
+
require "dry/auto_inject"
|
5
|
+
require "dry/auto_inject/version"
|
6
|
+
|
7
|
+
if Gem::Version.new(Dry::AutoInject::VERSION) < Gem::Version.new("0.10.0")
|
8
|
+
raise RuntimeError, "dry-effects requires dry-auto_inject >= 0.10.0"
|
9
|
+
end
|
5
10
|
|
6
11
|
module Dry
|
7
12
|
module Effects
|
8
13
|
class DryAutoEffectsStrategies
|
9
|
-
extend ::
|
14
|
+
extend Core::Container::Mixin
|
10
15
|
|
11
16
|
class Base < AutoInject::Strategies::Constructor
|
12
17
|
private
|
data/lib/dry/effects/version.rb
CHANGED
data/lib/dry/effects.rb
CHANGED
@@ -4,7 +4,6 @@ require "zeitwerk"
|
|
4
4
|
require "concurrent/map"
|
5
5
|
|
6
6
|
require "dry/core"
|
7
|
-
require "dry/container"
|
8
7
|
require "dry/inflector"
|
9
8
|
require "dry/initializer"
|
10
9
|
|
@@ -35,7 +34,7 @@ module Dry
|
|
35
34
|
loader.ignore(
|
36
35
|
"#{root}/dry-effects.rb",
|
37
36
|
"#{root}/dry/effects/{all,error,extensions,inflector,initializer,version}.rb",
|
38
|
-
"#{root}/dry/effects/extensions/**/*.rb"
|
37
|
+
"#{root}/dry/effects/extensions/**/*.rb"
|
39
38
|
)
|
40
39
|
end
|
41
40
|
end
|
data/lib/dry-effects.rb
CHANGED
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.4.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: 2022-
|
11
|
+
date: 2022-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -25,79 +25,61 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: dry-
|
28
|
+
name: dry-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 0.7.2
|
33
|
+
version: '1.0'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.7.2
|
40
|
+
version: '1.0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: dry-
|
42
|
+
name: dry-inflector
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
45
|
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0.9'
|
47
|
+
version: '1.0'
|
57
48
|
type: :runtime
|
58
49
|
prerelease: false
|
59
50
|
version_requirements: !ruby/object:Gem::Requirement
|
60
51
|
requirements:
|
61
52
|
- - "~>"
|
62
53
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: '0.9'
|
54
|
+
version: '1.0'
|
67
55
|
- !ruby/object:Gem::Dependency
|
68
|
-
name: dry-
|
56
|
+
name: dry-initializer
|
69
57
|
requirement: !ruby/object:Gem::Requirement
|
70
58
|
requirements:
|
71
59
|
- - "~>"
|
72
60
|
- !ruby/object:Gem::Version
|
73
|
-
version: '0
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: 0.1.2
|
61
|
+
version: '3.0'
|
77
62
|
type: :runtime
|
78
63
|
prerelease: false
|
79
64
|
version_requirements: !ruby/object:Gem::Requirement
|
80
65
|
requirements:
|
81
66
|
- - "~>"
|
82
67
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0
|
84
|
-
- - ">="
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 0.1.2
|
68
|
+
version: '3.0'
|
87
69
|
- !ruby/object:Gem::Dependency
|
88
|
-
name:
|
70
|
+
name: zeitwerk
|
89
71
|
requirement: !ruby/object:Gem::Requirement
|
90
72
|
requirements:
|
91
73
|
- - "~>"
|
92
74
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
75
|
+
version: '2.6'
|
94
76
|
type: :runtime
|
95
77
|
prerelease: false
|
96
78
|
version_requirements: !ruby/object:Gem::Requirement
|
97
79
|
requirements:
|
98
80
|
- - "~>"
|
99
81
|
- !ruby/object:Gem::Version
|
100
|
-
version: '
|
82
|
+
version: '2.6'
|
101
83
|
- !ruby/object:Gem::Dependency
|
102
84
|
name: bundler
|
103
85
|
requirement: !ruby/object:Gem::Requirement
|