ii_interactor 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c79c0121d27c8cad771bd23d536973d41104d55ee8a4b1abdaad5ebc1897e6ab
4
- data.tar.gz: 4b08ff80da16cd5f09862ed00ba37dcbd367150324d2b139dba6f5a26b7acd08
3
+ metadata.gz: d84fbe8e54e1c6e2ae2db5e42a0fa69e6242e625ff959544e47b6f51487c5197
4
+ data.tar.gz: 1abd9bcdc2f2f54286f09216ff4a65df6b932a404bfdfd2cfeb6365167e8d3c3
5
5
  SHA512:
6
- metadata.gz: 714ad9fef43f166649520ca0bf3b03a6b8ad64ddde463e01e81da4ff804da3697809574a21f1ddd834619990735a158a3d70e36d37e68ff4ddbb5c1a1690655f
7
- data.tar.gz: 60026aa2fcec05c0ab74df69c853072c3aa90a8817b5bb926de2c87c02decfd76edc5865e90da78257b2aba82c4ffc65a51c30f25e706dc7af5030f3a9b692d7
6
+ metadata.gz: 7dacc28bf13a431d29cb1033c5b22564033be5411faf9db9735797daacb3f643ffab744b95e596fe5830cd8bb20838d2935e891bd9e2edfbb2610cdd65ef700c
7
+ data.tar.gz: b5fa3f044ec335297efc753236f4a2e4d8e8e29d394cdace78f8ad7d29a4e9fd85152a83e87520da759f55f48449fe4416bd8bc228a852d80947f46f13606130
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.3.1
4
+
5
+ * Deprecate `context_in` and `context_out`. Use `context` instead.
6
+
3
7
  ## 2.3.0
4
8
 
5
9
  * Change name of instrumentation for rails 7.1.
data/README.md CHANGED
@@ -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
- context_in :message
31
- context_out :result
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="something", result="called by something">
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
- `context_in` copies context to instance variables of interactor,
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
- context_in :input, required: true
54
+ context :input, required: true
56
55
  end
57
56
 
58
57
  Interactor.call
59
- #=> IIInteractor::RequiredContextError (missing required context: input2)
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
- context_in :input, default: 'input'
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
- context_out :result, from_return: true
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IIInteractor
4
- VERSION = '2.3.0'
4
+ VERSION = '2.3.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ii_interactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshikazu Kaneta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2024-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport