service_actor 3.9.0 → 3.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/service_actor/arguments_validator.rb +1 -0
- data/lib/service_actor/playable.rb +10 -13
- data/lib/service_actor/result.rb +8 -4
- data/lib/service_actor/version.rb +1 -1
- 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: f2483bd7441afe757bcfb29be028fdf518575f1c87c5c3470858248c78702db8
|
4
|
+
data.tar.gz: 78f16e2ad2d5ca6169e3c21ede1672c23e24037f753c5072a6dee834444f53ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a80ea6854ca7084e4cf9f1acb3d706d4e749b52965f88a13ce48eb9769e5ce700195f18b760454a60855f92d408b29dd48fa7a58587d3f8b0a7a1647f53942e
|
7
|
+
data.tar.gz: 467f81ee0496d1a22888df3388e41cf16755d288a2a6416ca0c9c774bfe5ab3d4a883e6a730a240271227626aa7a7dc65c3ce177e292051f28d477d718dfecf7
|
@@ -90,16 +90,19 @@ module ServiceActor::Playable
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def play_actor(actor)
|
93
|
-
|
94
|
-
|
95
|
-
|
93
|
+
if actor.is_a?(Symbol)
|
94
|
+
send(actor)
|
95
|
+
elsif actor.is_a?(Class) && actor.ancestors.include?(ServiceActor::Core)
|
96
|
+
play_service_actor(actor)
|
97
|
+
elsif actor.is_a?(Class) &&
|
98
|
+
actor.ancestors.map(&:name).include?("Interactor")
|
99
|
+
play_interactor(actor)
|
100
|
+
else
|
96
101
|
actor.call(result)
|
102
|
+
end
|
97
103
|
end
|
98
104
|
|
99
105
|
def play_service_actor(actor)
|
100
|
-
return unless actor.is_a?(Class)
|
101
|
-
return unless actor.ancestors.include?(ServiceActor::Core)
|
102
|
-
|
103
106
|
actor = actor.new(result)
|
104
107
|
call_output = actor._call
|
105
108
|
|
@@ -109,16 +112,10 @@ module ServiceActor::Playable
|
|
109
112
|
end
|
110
113
|
|
111
114
|
def play_method(actor)
|
112
|
-
|
113
|
-
|
114
|
-
# return truthy method value, or true as fallback
|
115
|
-
send(actor) || true
|
115
|
+
send(actor)
|
116
116
|
end
|
117
117
|
|
118
118
|
def play_interactor(actor)
|
119
|
-
return unless actor.is_a?(Class)
|
120
|
-
return unless actor.ancestors.map(&:name).include?("Interactor")
|
121
|
-
|
122
119
|
result.merge!(actor.call(result.to_h).to_h)
|
123
120
|
end
|
124
121
|
end
|
data/lib/service_actor/result.rb
CHANGED
@@ -12,21 +12,25 @@ class ServiceActor::Result < BasicObject
|
|
12
12
|
end
|
13
13
|
|
14
14
|
%i[
|
15
|
+
block_given?
|
15
16
|
class
|
17
|
+
instance_variables
|
16
18
|
is_a?
|
17
19
|
kind_of?
|
18
|
-
|
20
|
+
nil?
|
21
|
+
object_id
|
22
|
+
private_methods
|
19
23
|
public_send
|
24
|
+
send
|
20
25
|
tap
|
21
26
|
then
|
22
|
-
|
23
|
-
object_id
|
24
|
-
instance_variables
|
27
|
+
methods
|
25
28
|
].each do |method_name|
|
26
29
|
define_method(method_name, ::Kernel.instance_method(method_name))
|
27
30
|
end
|
28
31
|
|
29
32
|
alias_method :yield_self, :then
|
33
|
+
alias_method :blank?, :nil?
|
30
34
|
|
31
35
|
def initialize(data = {})
|
32
36
|
@data = data.to_h
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service_actor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.9.
|
4
|
+
version: 3.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunny Ripert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|