servactory 1.6.12 → 1.6.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ccc9a97612c6e1ceabdc7af5cf7721db8e6cf69f6a4028b040937b70a666455
4
- data.tar.gz: d40c5f206135cd7b2c4f0e2d58cdb0cb5ac147c44c06fb270ed55dd0361c1f2a
3
+ metadata.gz: 8a9d23fed4bbdc5728e707c47939ccfd2ed055c3bf052300908d09816ce580b7
4
+ data.tar.gz: e64b68886cb0e74706fddf989f1facedf37fd6020419f1d11f533229688b55f1
5
5
  SHA512:
6
- metadata.gz: 6b2e77ca62432273803111620519934121c5ece37f689b264814a5ea0f97382a3b046a969d4c6385080aa48a13627929c26f4d7a44c4afe6baf481a9bc372ed9
7
- data.tar.gz: 2dc3b575db383250a16a30c287a2f2349864889ec66469ad6ed544dc6db3c12a1fc56e434ed36fcab45572c8ab3341974e629c489e93fe6df647f07381246004
6
+ metadata.gz: b108bb63a08baef6a09e11aa85f93407ce857a309e6d7e816a089db79285df5020a216ee3c4a1bef5ab87dd82951058514d11fbcd6c6b7682e2d984170545856
7
+ data.tar.gz: 6ae5e3e1ab815608900749693d010397c584439f809e71aac8ccbf00007285b625bcbe258a45cec22c95f3ef340e5f1b0f202b1747d71cbe7902f3707a85ec06
@@ -3,6 +3,7 @@
3
3
  module Servactory
4
4
  class Base
5
5
  include Configuration::DSL
6
+ include Info::DSL
6
7
  include Context::DSL
7
8
  include Inputs::DSL
8
9
  include Internals::DSL
@@ -28,8 +28,12 @@ module Servactory
28
28
  )
29
29
  end
30
30
 
31
- def fail!(message:, meta: nil)
32
- failure = Servactory.configuration.failure_class.new(message: message, meta: meta)
31
+ def fail!(
32
+ message:,
33
+ failure_class: Servactory.configuration.failure_class,
34
+ meta: nil
35
+ )
36
+ failure = failure_class.new(message: message, meta: meta)
33
37
 
34
38
  raise failure if @service_strict_mode
35
39
 
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Servactory
4
+ module Info
5
+ module DSL
6
+ def self.included(base)
7
+ base.extend(ClassMethods)
8
+ end
9
+
10
+ module ClassMethods
11
+ def info
12
+ Servactory::Info::Result.new(
13
+ inputs: collection_of_inputs.names,
14
+ internals: collection_of_internals.names,
15
+ outputs: collection_of_outputs.names
16
+ )
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Servactory
4
+ module Info
5
+ class Result
6
+ attr_reader :inputs,
7
+ :internals,
8
+ :outputs
9
+
10
+ def initialize(inputs:, internals:, outputs:)
11
+ @inputs = inputs
12
+ @internals = internals
13
+ @outputs = outputs
14
+ end
15
+ end
16
+ end
17
+ end
@@ -38,9 +38,9 @@ module Servactory
38
38
  end
39
39
 
40
40
  def check # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
41
- if @input.array? && @value.present?
41
+ if @input.array? && Servactory::Utils.value_present?(@value)
42
42
  return if @value.respond_to?(:all?) && @value.all?(&:present?)
43
- elsif @value.present?
43
+ elsif Servactory::Utils.value_present?(@value)
44
44
  return
45
45
  end
46
46
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Test
4
+ module TestKit
5
5
  class FakeType; end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- module Test
4
+ module TestKit
5
5
  class Result
6
6
  def initialize(**attributes)
7
7
  attributes.each_pair do |method_name, method_return|
@@ -9,5 +9,11 @@ module Servactory
9
9
  def true?(value)
10
10
  value.to_s.casecmp("true").to_i.zero?
11
11
  end
12
+
13
+ def value_present?(value)
14
+ !value.nil? && (
15
+ value.respond_to?(:empty?) ? !value.empty? : true
16
+ )
17
+ end
12
18
  end
13
19
  end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 6
7
- PATCH = 12
7
+ PATCH = 14
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
10
10
  end
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: 1.6.12
4
+ version: 1.6.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-13 00:00:00.000000000 Z
11
+ date: 2023-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -205,6 +205,8 @@ files:
205
205
  - lib/servactory/errors/input_error.rb
206
206
  - lib/servactory/errors/internal_error.rb
207
207
  - lib/servactory/errors/output_error.rb
208
+ - lib/servactory/info/dsl.rb
209
+ - lib/servactory/info/result.rb
208
210
  - lib/servactory/inputs/collection.rb
209
211
  - lib/servactory/inputs/define_input_conflict.rb
210
212
  - lib/servactory/inputs/define_input_method.rb
@@ -249,8 +251,8 @@ files:
249
251
  - lib/servactory/outputs/validations/type.rb
250
252
  - lib/servactory/outputs/workbench.rb
251
253
  - lib/servactory/result.rb
252
- - lib/servactory/test/fake_type.rb
253
- - lib/servactory/test/result.rb
254
+ - lib/servactory/test_kit/fake_type.rb
255
+ - lib/servactory/test_kit/result.rb
254
256
  - lib/servactory/utils.rb
255
257
  - lib/servactory/version.rb
256
258
  homepage: https://github.com/afuno/servactory