servactory 2.4.1 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/servactory/context/callable.rb +1 -1
- data/lib/servactory/result.rb +20 -4
- data/lib/servactory/test_kit/result.rb +2 -2
- data/lib/servactory/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: 326823cbdccc9f0f3dfca48c5b2ddbf518d50a713c45280b19da21ddf4483907
|
4
|
+
data.tar.gz: ebf05e0ebdd4b9941809137d3f1e092ac72560fc199689d91713c253edcb3cd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b99933c23fd601a8e5164a425695799b94648da7ba02232a676938f00466ce8bc60ecc59db4257f3d9e1b60ba98dbabb3f021bfbff263c085fe7c800c0b47976
|
7
|
+
data.tar.gz: db16a9b4bbdfcfa4fdd11c6eabf8ae45468c8989d34ddc6a268df17e29e68878c5be9db72fda4a5e07529d2a6ccd3a9e2a1a2eb73b60389e9bd9fd637b894a56
|
@@ -22,7 +22,7 @@ module Servactory
|
|
22
22
|
rescue config.success_class => e
|
23
23
|
Servactory::Result.success_for(context: e.context)
|
24
24
|
rescue config.failure_class => e
|
25
|
-
Servactory::Result.failure_for(exception: e)
|
25
|
+
Servactory::Result.failure_for(context: context, exception: e)
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
data/lib/servactory/result.rb
CHANGED
@@ -9,6 +9,18 @@ module Servactory
|
|
9
9
|
define_singleton_method(key) { value }
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
def inspect
|
14
|
+
"#<#{self.class.name} #{draw_result}>"
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def draw_result
|
20
|
+
methods(false).sort.map do |method_name|
|
21
|
+
"@#{method_name}=#{send(method_name)}"
|
22
|
+
end.join(", ")
|
23
|
+
end
|
12
24
|
end
|
13
25
|
|
14
26
|
private_constant :Outputs
|
@@ -19,11 +31,11 @@ module Servactory
|
|
19
31
|
new(context: context).send(:as_success)
|
20
32
|
end
|
21
33
|
|
22
|
-
def self.failure_for(exception:)
|
23
|
-
new(exception: exception).send(:as_failure)
|
34
|
+
def self.failure_for(context:, exception:)
|
35
|
+
new(context: context, exception: exception).send(:as_failure)
|
24
36
|
end
|
25
37
|
|
26
|
-
def initialize(context
|
38
|
+
def initialize(context:, exception: nil)
|
27
39
|
@context = context
|
28
40
|
@exception = exception
|
29
41
|
end
|
@@ -39,7 +51,7 @@ module Servactory
|
|
39
51
|
end
|
40
52
|
|
41
53
|
def on_failure(type = :all)
|
42
|
-
yield(exception: @exception) if failure? && [:all, @exception&.type].include?(type)
|
54
|
+
yield(outputs: outputs, exception: @exception) if failure? && [:all, @exception&.type].include?(type)
|
43
55
|
|
44
56
|
self
|
45
57
|
end
|
@@ -78,6 +90,10 @@ module Servactory
|
|
78
90
|
false
|
79
91
|
end
|
80
92
|
|
93
|
+
outputs.methods(false).each do |method_name|
|
94
|
+
define_singleton_method(method_name) { outputs.send(method_name) }
|
95
|
+
end
|
96
|
+
|
81
97
|
self
|
82
98
|
end
|
83
99
|
|
@@ -7,8 +7,8 @@ module Servactory
|
|
7
7
|
Servactory::Result.success_for(context: new(attributes))
|
8
8
|
end
|
9
9
|
|
10
|
-
def self.as_failure(exception: nil)
|
11
|
-
Servactory::Result.failure_for(exception: exception)
|
10
|
+
def self.as_failure(attributes = {}, exception: nil)
|
11
|
+
Servactory::Result.failure_for(context: new(attributes), exception: exception)
|
12
12
|
end
|
13
13
|
|
14
14
|
def initialize(attributes = {})
|
data/lib/servactory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|