actioninteractor 0.0.10 → 0.0.11
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/lib/action_interactor/base.rb +22 -32
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9617a17572e95293b80bd340063fda1efefd5805bb11cc2bc28857edb385315d
|
4
|
+
data.tar.gz: 22150773168c08745bc68eaf4ef86314b3456e32773a3d3e7354eb045f4ccfc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2b6905a31232fac03a9f9a7211eee9018c46d3bf22961047f179080431b80471812e90f2b93d2051dcdfac9ad7da23b67d06dc480bc5513555f49bf2e941904
|
7
|
+
data.tar.gz: c2ce5e22e7ea4997fc9fc14280a2b4625c52449fd25ee06924e1276b35762254c590a23eb522c5ca341035624f6f5b18235c0ab6f6fde4d95c86217f069a60f1
|
@@ -10,20 +10,25 @@ module ActionInteractor
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def execute
|
13
|
-
|
14
|
-
|
13
|
+
# if the interactor already finished execution, do nothing.
|
14
|
+
return if finished?
|
15
|
+
# if contract is not satisfied= (ex: params is empty), mark as failed.
|
16
|
+
return fail! if params.nil?
|
17
|
+
# implement some codes
|
18
|
+
# if finished execution, mark as success.
|
19
|
+
success!
|
15
20
|
end
|
16
21
|
|
17
|
-
def
|
18
|
-
@
|
22
|
+
def finished?
|
23
|
+
@_finished
|
19
24
|
end
|
20
25
|
|
21
|
-
def
|
22
|
-
!
|
26
|
+
def unfinished?
|
27
|
+
!finished?
|
23
28
|
end
|
24
29
|
|
25
30
|
def success?
|
26
|
-
@
|
31
|
+
@_success
|
27
32
|
end
|
28
33
|
|
29
34
|
def failure?
|
@@ -31,44 +36,29 @@ module ActionInteractor
|
|
31
36
|
end
|
32
37
|
|
33
38
|
def aborted?
|
34
|
-
failure? &&
|
39
|
+
failure? && unfinished?
|
35
40
|
end
|
36
41
|
|
37
42
|
def reset!
|
38
43
|
@result = {}
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
def finish!
|
44
|
-
success!
|
45
|
-
complete!
|
46
|
-
end
|
47
|
-
|
48
|
-
def failed!
|
49
|
-
fail!
|
50
|
-
complete!
|
44
|
+
@_success = false
|
45
|
+
@_finished = false
|
51
46
|
end
|
52
47
|
|
53
48
|
def abort!
|
54
|
-
|
55
|
-
|
49
|
+
@_success = false
|
50
|
+
@_finished = false
|
56
51
|
end
|
57
52
|
|
58
53
|
def success!
|
59
|
-
@
|
54
|
+
@_success = true
|
55
|
+
@_finished = true
|
60
56
|
end
|
57
|
+
alias_method :finish!, :success!
|
61
58
|
|
62
59
|
def fail!
|
63
|
-
@
|
64
|
-
|
65
|
-
|
66
|
-
def complete!
|
67
|
-
@completed = true
|
68
|
-
end
|
69
|
-
|
70
|
-
def incomplete!
|
71
|
-
@completed = false
|
60
|
+
@_success = false
|
61
|
+
@_finished = true
|
72
62
|
end
|
73
63
|
|
74
64
|
def add_result(key, value)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actioninteractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|