service_actor 3.9.3 → 3.9.4
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/failure.rb +1 -1
- data/lib/service_actor/result.rb +18 -4
- data/lib/service_actor/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f91c36f4113eb695e8398ac43395dc85b5f51cb103c2dcdc72b8e351839932a7
|
4
|
+
data.tar.gz: f536f4d3d552d07544cd46706faca94240711758ba39da68e07db7e819236b24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e8260d8e84d2ef2c918e01eb13c8ac0417bff3cf3f0683acc3a3d6281184c9ef9d6af1c20d0cba3c65b74ba51a48ae3a72ba40e2c64280df936c307331957b4
|
7
|
+
data.tar.gz: 0a93c5b2eecc2e1cd7724b3a42ffd7664d4caa069de6066a2ae3f0c40fdc405492c0ec2cea964cf92df6016a34296c07acad48f7f018a6b46bd26a7864be5378
|
data/lib/service_actor/result.rb
CHANGED
@@ -14,9 +14,12 @@ class ServiceActor::Result < BasicObject
|
|
14
14
|
%i[
|
15
15
|
block_given?
|
16
16
|
class
|
17
|
+
hash
|
18
|
+
instance_of?
|
17
19
|
instance_variables
|
18
20
|
is_a?
|
19
21
|
kind_of?
|
22
|
+
methods
|
20
23
|
nil?
|
21
24
|
object_id
|
22
25
|
private_methods
|
@@ -24,7 +27,6 @@ class ServiceActor::Result < BasicObject
|
|
24
27
|
send
|
25
28
|
tap
|
26
29
|
then
|
27
|
-
methods
|
28
30
|
].each do |method_name|
|
29
31
|
define_method(method_name, ::Kernel.instance_method(method_name))
|
30
32
|
end
|
@@ -33,7 +35,7 @@ class ServiceActor::Result < BasicObject
|
|
33
35
|
alias_method :blank?, :nil?
|
34
36
|
|
35
37
|
def initialize(data = {})
|
36
|
-
@data = data.to_h
|
38
|
+
@data = data.to_h.transform_keys(&:to_sym)
|
37
39
|
end
|
38
40
|
|
39
41
|
def to_h
|
@@ -44,7 +46,11 @@ class ServiceActor::Result < BasicObject
|
|
44
46
|
"<#{self.class.name} #{to_h}>"
|
45
47
|
end
|
46
48
|
|
47
|
-
|
49
|
+
def pretty_print(pp)
|
50
|
+
pp.text "#<#{self.class.name} "
|
51
|
+
pp.pp to_h
|
52
|
+
pp.text ">"
|
53
|
+
end
|
48
54
|
|
49
55
|
def fail!(failure_class = nil, result = {})
|
50
56
|
if failure_class.nil? || failure_class.is_a?(::Hash)
|
@@ -71,24 +77,32 @@ class ServiceActor::Result < BasicObject
|
|
71
77
|
end
|
72
78
|
|
73
79
|
def merge!(result)
|
74
|
-
data.merge!(result)
|
80
|
+
data.merge!(result.transform_keys(&:to_sym))
|
75
81
|
|
76
82
|
self
|
77
83
|
end
|
78
84
|
|
79
85
|
def key?(name)
|
86
|
+
name = name.to_sym
|
87
|
+
|
80
88
|
to_h.key?(name)
|
81
89
|
end
|
82
90
|
|
83
91
|
def [](name)
|
92
|
+
name = name.to_sym
|
93
|
+
|
84
94
|
data[name]
|
85
95
|
end
|
86
96
|
|
87
97
|
def []=(key, value)
|
98
|
+
key = key.to_sym
|
99
|
+
|
88
100
|
data[key] = value
|
89
101
|
end
|
90
102
|
|
91
103
|
def delete!(key)
|
104
|
+
key = key.to_sym
|
105
|
+
|
92
106
|
data.delete(key)
|
93
107
|
end
|
94
108
|
|
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.4
|
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-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.1'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-thread_safety
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.1'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.1'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: code-scanning-rubocop
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|