servactory 2.4.0 → 2.4.1
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/servactory/context/callable.rb +5 -17
- data/lib/servactory/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39039d8976222bae22b66ec4ee41d231a5ec589509bd32e15c717b0ef6c89d19
|
4
|
+
data.tar.gz: 8c4de62f3d586fc7d767d17cd6918b30e7a0521e2bb01e3ed5f69e34b26694db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b062e9ceeb16e47ee61133fccda32d8bca81e57424e76a849d7cdf9fb3491016a4a2ca61675142319a11f1286d9bdcc9388db5c4069d8d434df3ab827adc1124
|
7
|
+
data.tar.gz: fdd074ac75c620cfdd41a5fb6173d83b7d87835d0bf1a572bf5e815e7f1db028312a6b7afc91c19ad06208917318afe884a87de64685853868c6dea57ab3ff57
|
@@ -4,41 +4,29 @@ module Servactory
|
|
4
4
|
module Context
|
5
5
|
module Callable
|
6
6
|
def call!(arguments = {})
|
7
|
-
prepare_result_class
|
8
|
-
|
9
7
|
context = send(:new)
|
10
8
|
|
11
9
|
_call!(context, **arguments)
|
12
10
|
|
13
|
-
|
11
|
+
Servactory::Result.success_for(context: context)
|
14
12
|
rescue config.success_class => e
|
15
|
-
|
13
|
+
Servactory::Result.success_for(context: e.context)
|
16
14
|
end
|
17
15
|
|
18
16
|
def call(arguments = {})
|
19
|
-
prepare_result_class
|
20
|
-
|
21
17
|
context = send(:new)
|
22
18
|
|
23
19
|
_call!(context, **arguments)
|
24
20
|
|
25
|
-
|
21
|
+
Servactory::Result.success_for(context: context)
|
26
22
|
rescue config.success_class => e
|
27
|
-
|
23
|
+
Servactory::Result.success_for(context: e.context)
|
28
24
|
rescue config.failure_class => e
|
29
|
-
|
25
|
+
Servactory::Result.failure_for(exception: e)
|
30
26
|
end
|
31
27
|
|
32
28
|
private
|
33
29
|
|
34
|
-
def prepare_result_class
|
35
|
-
return if Object.const_defined?("#{name}::Result")
|
36
|
-
|
37
|
-
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
38
|
-
Result = Class.new(Servactory::Result)
|
39
|
-
RUBY
|
40
|
-
end
|
41
|
-
|
42
30
|
def _call!(context, **arguments)
|
43
31
|
context.send(
|
44
32
|
:_call!,
|
data/lib/servactory/version.rb
CHANGED