servactory 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/servactory/configuration/factory.rb +1 -31
- data/lib/servactory/result.rb +11 -0
- data/lib/servactory/version.rb +1 -1
- metadata +2 -6
- data/lib/servactory/errors/failure.rb +0 -20
- data/lib/servactory/errors/input_error.rb +0 -20
- data/lib/servactory/errors/internal_error.rb +0 -20
- data/lib/servactory/errors/output_error.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd2afd31c63b79469991b78c2c30728aa2d268eeaf9deac3ea0e72c06db6614
|
4
|
+
data.tar.gz: e11af49a2bc836b3f265c4dc48957106550b905c05682cb837099ed53a62c24a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d22e4e63465bcc22943d6eb90085081ba299ea571cea5393fabc22dae15d434e05b51f78f7fd26d27d93d3775419d89c24a47c492c2a8808565e5a8d6f0bfc4
|
7
|
+
data.tar.gz: cb529f9e8c66ef9de222ae4a66b0884635f1dda2435020a67d024c61686f6ffa1434e80b773e71a66c84776e55e305240bbc4e26c5cd4cfc22b5483500b8bff7
|
@@ -2,41 +2,11 @@
|
|
2
2
|
|
3
3
|
module Servactory
|
4
4
|
module Configuration
|
5
|
-
class Factory
|
5
|
+
class Factory
|
6
6
|
def initialize(config)
|
7
7
|
@config = config
|
8
8
|
end
|
9
9
|
|
10
|
-
# DEPRECATED: These configs must be deleted after release 2.4.
|
11
|
-
def input_error_class(input_error_class)
|
12
|
-
Kernel.warn "DEPRECATION WARNING: " \
|
13
|
-
"Configuration `input_error_class` is deprecated; " \
|
14
|
-
"use `internal_exception_class` instead. " \
|
15
|
-
"It will be removed in one of the next releases."
|
16
|
-
|
17
|
-
input_exception_class(input_error_class)
|
18
|
-
end
|
19
|
-
|
20
|
-
# DEPRECATED: These configs must be deleted after release 2.4.
|
21
|
-
def internal_error_class(internal_error_class)
|
22
|
-
Kernel.warn "DEPRECATION WARNING: " \
|
23
|
-
"Configuration `internal_error_class` is deprecated; " \
|
24
|
-
"use `internal_exception_class` instead. " \
|
25
|
-
"It will be removed in one of the next releases."
|
26
|
-
|
27
|
-
internal_exception_class(internal_error_class)
|
28
|
-
end
|
29
|
-
|
30
|
-
# DEPRECATED: These configs must be deleted after release 2.4.
|
31
|
-
def output_error_class(output_error_class)
|
32
|
-
Kernel.warn "DEPRECATION WARNING: " \
|
33
|
-
"Configuration `output_error_class` is deprecated; " \
|
34
|
-
"use `output_exception_class` instead. " \
|
35
|
-
"It will be removed in one of the next releases."
|
36
|
-
|
37
|
-
output_exception_class(output_error_class)
|
38
|
-
end
|
39
|
-
|
40
10
|
def input_exception_class(input_exception_class)
|
41
11
|
return @config.input_exception_class = input_exception_class if subclass_of_exception?(input_exception_class)
|
42
12
|
|
data/lib/servactory/result.rb
CHANGED
@@ -27,6 +27,9 @@ module Servactory
|
|
27
27
|
|
28
28
|
############################################################################
|
29
29
|
|
30
|
+
STATE_PREDICATE_NAMES = %i[success? failure?].freeze
|
31
|
+
private_constant :STATE_PREDICATE_NAMES
|
32
|
+
|
30
33
|
def self.success_for(context:)
|
31
34
|
new(context:).send(:as_success)
|
32
35
|
end
|
@@ -40,6 +43,14 @@ module Servactory
|
|
40
43
|
@exception = exception
|
41
44
|
end
|
42
45
|
|
46
|
+
def to_h
|
47
|
+
filtered = methods(false).filter do |key|
|
48
|
+
!key.in?(STATE_PREDICATE_NAMES) && !key.to_s.end_with?("?")
|
49
|
+
end
|
50
|
+
|
51
|
+
filtered.to_h { |key| [key, public_send(key)] }.compact
|
52
|
+
end
|
53
|
+
|
43
54
|
def inspect
|
44
55
|
"#<#{self.class.name} #{draw_result}>"
|
45
56
|
end
|
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
|
+
version: 2.8.0
|
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-08-
|
11
|
+
date: 2024-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -271,10 +271,6 @@ files:
|
|
271
271
|
- lib/servactory/context/workspace/outputs.rb
|
272
272
|
- lib/servactory/dsl.rb
|
273
273
|
- lib/servactory/engine.rb
|
274
|
-
- lib/servactory/errors/failure.rb
|
275
|
-
- lib/servactory/errors/input_error.rb
|
276
|
-
- lib/servactory/errors/internal_error.rb
|
277
|
-
- lib/servactory/errors/output_error.rb
|
278
274
|
- lib/servactory/exceptions/base.rb
|
279
275
|
- lib/servactory/exceptions/failure.rb
|
280
276
|
- lib/servactory/exceptions/input.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Errors
|
5
|
-
# DEPRECATED: This class will be deleted after release 2.4.
|
6
|
-
class Failure < Servactory::Exceptions::Base
|
7
|
-
attr_reader :type,
|
8
|
-
:message,
|
9
|
-
:meta
|
10
|
-
|
11
|
-
def initialize(type: :base, message:, meta: nil) # rubocop:disable Style/KeywordParametersOrder
|
12
|
-
@type = type
|
13
|
-
@message = message
|
14
|
-
@meta = meta
|
15
|
-
|
16
|
-
super(message)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Errors
|
5
|
-
# DEPRECATED: This class will be deleted after release 2.4.
|
6
|
-
class InputError < Servactory::Exceptions::Base
|
7
|
-
attr_reader :message,
|
8
|
-
:input_name,
|
9
|
-
:meta
|
10
|
-
|
11
|
-
def initialize(message:, input_name: nil, meta: nil)
|
12
|
-
@message = message
|
13
|
-
@input_name = input_name&.to_sym
|
14
|
-
@meta = meta
|
15
|
-
|
16
|
-
super(message)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Errors
|
5
|
-
# DEPRECATED: This class will be deleted after release 2.4.
|
6
|
-
class InternalError < Servactory::Exceptions::Base
|
7
|
-
attr_reader :message,
|
8
|
-
:internal_name,
|
9
|
-
:meta
|
10
|
-
|
11
|
-
def initialize(message:, internal_name: nil, meta: nil)
|
12
|
-
@message = message
|
13
|
-
@internal_name = internal_name&.to_sym
|
14
|
-
@meta = meta
|
15
|
-
|
16
|
-
super(message)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Errors
|
5
|
-
# DEPRECATED: This class will be deleted after release 2.4.
|
6
|
-
class OutputError < Servactory::Exceptions::Base
|
7
|
-
attr_reader :message,
|
8
|
-
:output_name,
|
9
|
-
:meta
|
10
|
-
|
11
|
-
def initialize(message:, output_name: nil, meta: nil)
|
12
|
-
@message = message
|
13
|
-
@output_name = output_name&.to_sym
|
14
|
-
@meta = meta
|
15
|
-
|
16
|
-
super(message)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|