ii_interactor 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +10 -45
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -0
- data/LICENSE +0 -0
- data/README.md +17 -12
- data/Rakefile +0 -0
- data/gemfiles/rails70.gemfile +9 -0
- data/gemfiles/rails71.gemfile +0 -0
- data/gemfiles/{rails61.gemfile → rails72.gemfile} +2 -2
- data/gemfiles/rails80.gemfile +6 -0
- data/gemfiles/rails81.gemfile +6 -0
- data/ii_interactor.gemspec +4 -3
- data/lib/ii_interactor/base.rb +0 -0
- data/lib/ii_interactor/callbacks.rb +0 -0
- data/lib/ii_interactor/coactors.rb +0 -0
- data/lib/ii_interactor/config.rb +0 -0
- data/lib/ii_interactor/context.rb +0 -0
- data/lib/ii_interactor/contextualizer.rb +4 -0
- data/lib/ii_interactor/core.rb +0 -0
- data/lib/ii_interactor/errors.rb +0 -0
- data/lib/ii_interactor/instrumentation.rb +0 -0
- data/lib/ii_interactor/log_subscriber.rb +0 -0
- data/lib/ii_interactor/version.rb +1 -1
- data/lib/ii_interactor.rb +0 -0
- metadata +13 -34
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/gemfiles/rails50.gemfile +0 -7
- data/gemfiles/rails51.gemfile +0 -7
- data/gemfiles/rails52.gemfile +0 -7
- data/gemfiles/rails60.gemfile +0 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32e4ea9de0df4ef6b080ce031471796c332e57c307ff3899ee39e04da91a3fc8
|
|
4
|
+
data.tar.gz: b33e00ce1c7aaa1eed7753a2307f216fbc8bfeccb7dad2a6bf9467555eb0434e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0f17c787b82bd2ec3f83b502819c0dd97c7256b02efc5e54647fc0a871a01e8ddae41b18086ef1972117f239a7acbbf64816d399791b975173a2e6afab0aea5
|
|
7
|
+
data.tar.gz: '0594bac0ab5a4d91ea4de8d9c8458f9c7c87e1f1fca3b52923f4782276e886b42f7c422c8a1d97672bb12b3a99a5d514107f9f0bbebc88dff7477112ea42a519'
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -8,57 +8,19 @@ jobs:
|
|
|
8
8
|
strategy:
|
|
9
9
|
fail-fast: false
|
|
10
10
|
matrix:
|
|
11
|
-
ruby: [
|
|
12
|
-
gemfile: ['
|
|
11
|
+
ruby: ['3.0', 3.1, 3.2, 3.3, 3.4, '4.0']
|
|
12
|
+
gemfile: ['rails70', 'rails71', 'rails72', 'rails80', 'rails81']
|
|
13
13
|
exclude:
|
|
14
|
-
- ruby: 2.3
|
|
15
|
-
gemfile: rails60
|
|
16
|
-
- ruby: 2.3
|
|
17
|
-
gemfile: rails61
|
|
18
|
-
- ruby: 2.3
|
|
19
|
-
gemfile: rails70
|
|
20
|
-
- ruby: 2.3
|
|
21
|
-
gemfile: rails71
|
|
22
|
-
- ruby: 2.4
|
|
23
|
-
gemfile: rails60
|
|
24
|
-
- ruby: 2.4
|
|
25
|
-
gemfile: rails61
|
|
26
|
-
- ruby: 2.4
|
|
27
|
-
gemfile: rails70
|
|
28
|
-
- ruby: 2.4
|
|
29
|
-
gemfile: rails71
|
|
30
|
-
- ruby: 2.5
|
|
31
|
-
gemfile: rails70
|
|
32
|
-
- ruby: 2.5
|
|
33
|
-
gemfile: rails71
|
|
34
|
-
- ruby: 2.6
|
|
35
|
-
gemfile: rails70
|
|
36
|
-
- ruby: 2.6
|
|
37
|
-
gemfile: rails71
|
|
38
14
|
- ruby: 3.0
|
|
39
|
-
gemfile:
|
|
15
|
+
gemfile: rails72
|
|
40
16
|
- ruby: 3.0
|
|
41
|
-
gemfile:
|
|
17
|
+
gemfile: rails80
|
|
42
18
|
- ruby: 3.0
|
|
43
|
-
gemfile:
|
|
19
|
+
gemfile: rails81
|
|
44
20
|
- ruby: 3.1
|
|
45
|
-
gemfile:
|
|
21
|
+
gemfile: rails80
|
|
46
22
|
- ruby: 3.1
|
|
47
|
-
gemfile:
|
|
48
|
-
- ruby: 3.1
|
|
49
|
-
gemfile: rails52
|
|
50
|
-
- ruby: 3.2
|
|
51
|
-
gemfile: rails50
|
|
52
|
-
- ruby: 3.2
|
|
53
|
-
gemfile: rails51
|
|
54
|
-
- ruby: 3.2
|
|
55
|
-
gemfile: rails52
|
|
56
|
-
- ruby: 3.3
|
|
57
|
-
gemfile: rails50
|
|
58
|
-
- ruby: 3.3
|
|
59
|
-
gemfile: rails51
|
|
60
|
-
- ruby: 3.3
|
|
61
|
-
gemfile: rails52
|
|
23
|
+
gemfile: rails81
|
|
62
24
|
|
|
63
25
|
name: ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }}
|
|
64
26
|
|
|
@@ -71,6 +33,9 @@ jobs:
|
|
|
71
33
|
with:
|
|
72
34
|
ruby-version: ${{ matrix.ruby }}
|
|
73
35
|
bundler-cache: true
|
|
36
|
+
- name: Bundle list
|
|
37
|
+
run: |
|
|
38
|
+
bundle list
|
|
74
39
|
- name: Run test
|
|
75
40
|
run: |
|
|
76
41
|
DEBUG=1 bundle exec rspec
|
data/.gitignore
CHANGED
|
File without changes
|
data/.rspec
CHANGED
|
File without changes
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/LICENSE
CHANGED
|
File without changes
|
data/README.md
CHANGED
|
@@ -6,8 +6,8 @@ This gem is inspired by [interactor](https://github.com/collectiveidea/interacto
|
|
|
6
6
|
|
|
7
7
|
## Dependencies
|
|
8
8
|
|
|
9
|
-
* ruby
|
|
10
|
-
* activesupport
|
|
9
|
+
* ruby 3.0+
|
|
10
|
+
* activesupport 7.0+
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -27,8 +27,8 @@ Create interactor with `call` method and call it as follows:
|
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
29
|
class Interactor < IIInteractor::Base
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
context :message
|
|
31
|
+
context :result
|
|
32
32
|
|
|
33
33
|
def call
|
|
34
34
|
@context.result = "called by #{@context.message}"
|
|
@@ -36,15 +36,14 @@ class Interactor < IIInteractor::Base
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
Interactor.call(message: 'something')
|
|
39
|
-
#=> #<IIInteractor::Context message
|
|
39
|
+
#=> #<IIInteractor::Context @_data={:message=>"something", :result=>"called by something"}>
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
The first argument of `Interactor.call` is set to `@context`.
|
|
43
43
|
The return value of `Interactor.call` is the same as `@context`.
|
|
44
44
|
|
|
45
|
-
You can define context variables used in interactor explicitly.
|
|
46
|
-
`
|
|
47
|
-
while `context_out` copies instance variables of interactor to context.
|
|
45
|
+
You can define context variables used in interactor explicitly by using the `context` method.
|
|
46
|
+
`context` method copies the input variables to instance variables of the interactor.
|
|
48
47
|
|
|
49
48
|
### Context options
|
|
50
49
|
|
|
@@ -52,18 +51,18 @@ You can define required context as follows:
|
|
|
52
51
|
|
|
53
52
|
```ruby
|
|
54
53
|
class Interactor < IIInteractor::Base
|
|
55
|
-
|
|
54
|
+
context :input, required: true
|
|
56
55
|
end
|
|
57
56
|
|
|
58
57
|
Interactor.call
|
|
59
|
-
#=>
|
|
58
|
+
#=> missing required context: input (Coactive::MissingContextError)
|
|
60
59
|
```
|
|
61
60
|
|
|
62
61
|
You can also define default value as follows:
|
|
63
62
|
|
|
64
63
|
```ruby
|
|
65
64
|
class Interactor < IIInteractor::Base
|
|
66
|
-
|
|
65
|
+
context :input, default: 'input'
|
|
67
66
|
|
|
68
67
|
def call
|
|
69
68
|
puts @input
|
|
@@ -78,7 +77,7 @@ You can also set context from return value of `call` method:
|
|
|
78
77
|
|
|
79
78
|
```ruby
|
|
80
79
|
class Interactor < IIInteractor::Base
|
|
81
|
-
|
|
80
|
+
context :result, output: :return
|
|
82
81
|
|
|
83
82
|
def call
|
|
84
83
|
'returned value'
|
|
@@ -139,6 +138,8 @@ end
|
|
|
139
138
|
class MainInteractor < IIInteractor::Base
|
|
140
139
|
coact AInteractor
|
|
141
140
|
coact BInteractor
|
|
141
|
+
|
|
142
|
+
context :message
|
|
142
143
|
end
|
|
143
144
|
|
|
144
145
|
context = MainInteractor.call
|
|
@@ -182,6 +183,8 @@ end
|
|
|
182
183
|
class MainInteractor < IIInteractor::Base
|
|
183
184
|
coact AInteractor
|
|
184
185
|
coact BInteractor
|
|
186
|
+
|
|
187
|
+
context :message
|
|
185
188
|
end
|
|
186
189
|
|
|
187
190
|
context = MainInteractor.call
|
|
@@ -208,6 +211,8 @@ For example:
|
|
|
208
211
|
|
|
209
212
|
```ruby
|
|
210
213
|
class Interactor < IIInteractor::Base
|
|
214
|
+
context :message
|
|
215
|
+
|
|
211
216
|
before_all do
|
|
212
217
|
puts "before_all"
|
|
213
218
|
end
|
data/Rakefile
CHANGED
|
File without changes
|
data/gemfiles/rails70.gemfile
CHANGED
data/gemfiles/rails71.gemfile
CHANGED
|
File without changes
|
data/ii_interactor.gemspec
CHANGED
|
@@ -17,12 +17,13 @@ Gem::Specification.new do |spec|
|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
18
18
|
spec.require_paths = ["lib"]
|
|
19
19
|
|
|
20
|
-
spec.
|
|
20
|
+
spec.required_ruby_version = ">= 3.0"
|
|
21
|
+
|
|
22
|
+
spec.add_dependency "activesupport", ">= 7.0"
|
|
21
23
|
spec.add_dependency "coactive", ">= 0.3"
|
|
22
24
|
|
|
23
|
-
spec.add_development_dependency "rails", ">= 5.0"
|
|
24
|
-
spec.add_development_dependency "sqlite3"
|
|
25
25
|
spec.add_development_dependency "rake"
|
|
26
26
|
spec.add_development_dependency "rspec-rails"
|
|
27
27
|
spec.add_development_dependency "simplecov"
|
|
28
|
+
spec.add_development_dependency "logger"
|
|
28
29
|
end
|
data/lib/ii_interactor/base.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/ii_interactor/config.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -13,6 +13,7 @@ module IIInteractor
|
|
|
13
13
|
|
|
14
14
|
class_methods do
|
|
15
15
|
def context_in(*names, **options)
|
|
16
|
+
warn "DEPRECATION WARNING: 'context_in' is deprecated. Use 'context :x' instead. (#{caller[0]})"
|
|
16
17
|
context(*names, **options)
|
|
17
18
|
end
|
|
18
19
|
|
|
@@ -20,6 +21,9 @@ module IIInteractor
|
|
|
20
21
|
options[:output] = true
|
|
21
22
|
if options.delete(:from_return)
|
|
22
23
|
options[:output] = :return
|
|
24
|
+
warn "DEPRECATION WARNING: 'context_out' is deprecated. Use 'context :x, output: :return' instead. (#{caller[0]})"
|
|
25
|
+
else
|
|
26
|
+
warn "DEPRECATION WARNING: 'context_out' is deprecated. Use 'context :x, output: true' instead. (#{caller[0]})"
|
|
23
27
|
end
|
|
24
28
|
context(*names, **options)
|
|
25
29
|
end
|
data/lib/ii_interactor/core.rb
CHANGED
|
File without changes
|
data/lib/ii_interactor/errors.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/ii_interactor.rb
CHANGED
|
File without changes
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ii_interactor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yoshikazu Kaneta
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -16,14 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '7.0'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
25
|
+
version: '7.0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: coactive
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -39,21 +38,7 @@ dependencies:
|
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '0.3'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '5.0'
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '5.0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: sqlite3
|
|
41
|
+
name: rake
|
|
57
42
|
requirement: !ruby/object:Gem::Requirement
|
|
58
43
|
requirements:
|
|
59
44
|
- - ">="
|
|
@@ -67,7 +52,7 @@ dependencies:
|
|
|
67
52
|
- !ruby/object:Gem::Version
|
|
68
53
|
version: '0'
|
|
69
54
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
55
|
+
name: rspec-rails
|
|
71
56
|
requirement: !ruby/object:Gem::Requirement
|
|
72
57
|
requirements:
|
|
73
58
|
- - ">="
|
|
@@ -81,7 +66,7 @@ dependencies:
|
|
|
81
66
|
- !ruby/object:Gem::Version
|
|
82
67
|
version: '0'
|
|
83
68
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
69
|
+
name: simplecov
|
|
85
70
|
requirement: !ruby/object:Gem::Requirement
|
|
86
71
|
requirements:
|
|
87
72
|
- - ">="
|
|
@@ -95,7 +80,7 @@ dependencies:
|
|
|
95
80
|
- !ruby/object:Gem::Version
|
|
96
81
|
version: '0'
|
|
97
82
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
83
|
+
name: logger
|
|
99
84
|
requirement: !ruby/object:Gem::Requirement
|
|
100
85
|
requirements:
|
|
101
86
|
- - ">="
|
|
@@ -123,15 +108,11 @@ files:
|
|
|
123
108
|
- LICENSE
|
|
124
109
|
- README.md
|
|
125
110
|
- Rakefile
|
|
126
|
-
- bin/console
|
|
127
|
-
- bin/setup
|
|
128
|
-
- gemfiles/rails50.gemfile
|
|
129
|
-
- gemfiles/rails51.gemfile
|
|
130
|
-
- gemfiles/rails52.gemfile
|
|
131
|
-
- gemfiles/rails60.gemfile
|
|
132
|
-
- gemfiles/rails61.gemfile
|
|
133
111
|
- gemfiles/rails70.gemfile
|
|
134
112
|
- gemfiles/rails71.gemfile
|
|
113
|
+
- gemfiles/rails72.gemfile
|
|
114
|
+
- gemfiles/rails80.gemfile
|
|
115
|
+
- gemfiles/rails81.gemfile
|
|
135
116
|
- ii_interactor.gemspec
|
|
136
117
|
- lib/ii_interactor.rb
|
|
137
118
|
- lib/ii_interactor/base.rb
|
|
@@ -148,7 +129,6 @@ files:
|
|
|
148
129
|
homepage: https://github.com/kanety/ii_interactor
|
|
149
130
|
licenses: []
|
|
150
131
|
metadata: {}
|
|
151
|
-
post_install_message:
|
|
152
132
|
rdoc_options: []
|
|
153
133
|
require_paths:
|
|
154
134
|
- lib
|
|
@@ -156,15 +136,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
156
136
|
requirements:
|
|
157
137
|
- - ">="
|
|
158
138
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: '0'
|
|
139
|
+
version: '3.0'
|
|
160
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
141
|
requirements:
|
|
162
142
|
- - ">="
|
|
163
143
|
- !ruby/object:Gem::Version
|
|
164
144
|
version: '0'
|
|
165
145
|
requirements: []
|
|
166
|
-
rubygems_version: 3.
|
|
167
|
-
signing_key:
|
|
146
|
+
rubygems_version: 3.6.9
|
|
168
147
|
specification_version: 4
|
|
169
148
|
summary: A base interactor to support management of bussiness logic
|
|
170
149
|
test_files: []
|
data/bin/console
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "bundler/setup"
|
|
4
|
-
require "ii_interactor"
|
|
5
|
-
|
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
-
|
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
-
# require "pry"
|
|
11
|
-
# Pry.start
|
|
12
|
-
|
|
13
|
-
require "irb"
|
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/gemfiles/rails50.gemfile
DELETED
data/gemfiles/rails51.gemfile
DELETED
data/gemfiles/rails52.gemfile
DELETED