servactory 2.6.1 → 2.6.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2a39700d311e8928abfbebb095ba075230533aef2939fd9668b8d649a257a00
|
4
|
+
data.tar.gz: 4da3314f25f0f24f499c3cc9d1a6ad08dfd516b747d2df1379513894fb0fad58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f1946fa5be2ad7762cdf751e0167f58c42f45ec2fe04943c21691e614d7b2680224d008dba256878809fe348aaeea93392f9eaf3594a7a4451753be97758079
|
7
|
+
data.tar.gz: 03d1c3295c54b92515b08073bba127fe5bb71529e174204b043ef428b8fd6bb1e673fc94f4f400059a50e17b845d06572601da8d137bbd570cf1a50cb07668e3
|
@@ -66,10 +66,10 @@ module Servactory
|
|
66
66
|
########################################################################
|
67
67
|
|
68
68
|
def message_for_input_with(service:, input:, value:, option_value:, reason:, **)
|
69
|
-
i18n_key = "
|
69
|
+
i18n_key = "inputs.validations.must.dynamic_options.consists_of"
|
70
70
|
i18n_key += reason.present? ? ".#{reason}" : ".default"
|
71
71
|
|
72
|
-
|
72
|
+
service.translate(
|
73
73
|
i18n_key,
|
74
74
|
service_class_name: service.class_name,
|
75
75
|
input_name: input.name,
|
@@ -79,10 +79,10 @@ module Servactory
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def message_for_internal_with(service:, internal:, value:, option_value:, reason:, **)
|
82
|
-
i18n_key = "
|
82
|
+
i18n_key = "internals.validations.must.dynamic_options.consists_of"
|
83
83
|
i18n_key += reason.present? ? ".#{reason}" : ".default"
|
84
84
|
|
85
|
-
|
85
|
+
service.translate(
|
86
86
|
i18n_key,
|
87
87
|
service_class_name: service.class_name,
|
88
88
|
internal_name: internal.name,
|
@@ -92,10 +92,10 @@ module Servactory
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def message_for_output_with(service:, output:, value:, option_value:, reason:, **)
|
95
|
-
i18n_key = "
|
95
|
+
i18n_key = "outputs.validations.must.dynamic_options.consists_of"
|
96
96
|
i18n_key += reason.present? ? ".#{reason}" : ".default"
|
97
97
|
|
98
|
-
|
98
|
+
service.translate(
|
99
99
|
i18n_key,
|
100
100
|
service_class_name: service.class_name,
|
101
101
|
output_name: output.name,
|
@@ -82,11 +82,25 @@ module Servactory
|
|
82
82
|
common_condition_with(...)
|
83
83
|
end
|
84
84
|
|
85
|
-
|
85
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
86
|
+
def common_condition_with(value:, option:, input: nil, internal: nil, output: nil)
|
86
87
|
option_value = option.value&.to_sym
|
87
88
|
|
88
89
|
return [false, :unknown] unless @formats.key?(option_value)
|
89
90
|
|
91
|
+
attribute = Utils.define_attribute_with(input: input, internal: internal, output: output)
|
92
|
+
|
93
|
+
if value.blank? &&
|
94
|
+
(
|
95
|
+
(attribute.input? && attribute.optional?) ||
|
96
|
+
(
|
97
|
+
(attribute.internal? || attribute.output?) &&
|
98
|
+
attribute.types.include?(NilClass)
|
99
|
+
)
|
100
|
+
)
|
101
|
+
return true
|
102
|
+
end
|
103
|
+
|
90
104
|
format_options = @formats.fetch(option_value)
|
91
105
|
|
92
106
|
format_pattern = option.properties.fetch(:pattern, format_options.fetch(:pattern))
|
@@ -95,6 +109,7 @@ module Servactory
|
|
95
109
|
|
96
110
|
option.properties.fetch(:validator, format_options.fetch(:validator)).call(value: value)
|
97
111
|
end
|
112
|
+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
98
113
|
|
99
114
|
########################################################################
|
100
115
|
|
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.6.
|
4
|
+
version: 2.6.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-
|
11
|
+
date: 2024-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -366,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
366
366
|
- !ruby/object:Gem::Version
|
367
367
|
version: '0'
|
368
368
|
requirements: []
|
369
|
-
rubygems_version: 3.5.
|
369
|
+
rubygems_version: 3.5.11
|
370
370
|
signing_key:
|
371
371
|
specification_version: 4
|
372
372
|
summary: A set of tools for building reliable services of any complexity
|