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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0392bf65a7bdc8c133d517c581655e2a29ce4665d8a2c9dcde7eec7e1a6d1cc
4
- data.tar.gz: 5f57c9201660ae628fb471f1bef146acb2face2aad22f10b02a0a1e2b1f9fd55
3
+ metadata.gz: 2fd2afd31c63b79469991b78c2c30728aa2d268eeaf9deac3ea0e72c06db6614
4
+ data.tar.gz: e11af49a2bc836b3f265c4dc48957106550b905c05682cb837099ed53a62c24a
5
5
  SHA512:
6
- metadata.gz: f6741ccebe3ddb1f8a7b6c2908a92b5b6a3f4af00d188c5e1d2f54f663d5758ebc3956c5a0ca2efa97fed0fe97187e594557083a0cd6ca2372487430c6ca005e
7
- data.tar.gz: e2374b66d0d8b6b3c49b07f66bc7532034957ff3985e4a776686f6c90329e2d30ed7b5f85834f12ef272a204c484689b8b6480a933256b8ec64fb274a69d58e4
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 # rubocop:disable Metrics/ClassLength
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
 
@@ -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
@@ -3,7 +3,7 @@
3
3
  module Servactory
4
4
  module VERSION
5
5
  MAJOR = 2
6
- MINOR = 7
6
+ MINOR = 8
7
7
  PATCH = 0
8
8
  PRE = nil
9
9
 
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.7.0
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-13 00:00:00.000000000 Z
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