servactory 2.6.1 → 2.6.2

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: 64f8eb059214e69b961c2e6a5c91565eff6372eaa64677a5d7da42f8f301d38b
4
- data.tar.gz: c49125a5572e80d044668bcd70b6f45bd9d4c0c0109fe6ce35238fc1b630d405
3
+ metadata.gz: 0ce5565f3e907fc4f2739acfd68389a9d10bfc1a0dbfdcafe81692d631c4ec96
4
+ data.tar.gz: 2e7dae944a0fd40907dbe2cfdb2593ee6f43e1d4112641643f917c76fbe8a90b
5
5
  SHA512:
6
- metadata.gz: 9c17c8c39353bca7c6efc198472c7c8e088a934ea1e9181522d653580ec3dad9f9046169b38396d1b2508860fe21b3fc1fef1eb0d6d84b7e913b50e78664a8ff
7
- data.tar.gz: a3555354a011e24848d9cbace96d5dad5db690d9a07b8cb41318b7e5820e24f04194f55b7faee4e38c8f7a521e13a2022f756802ce49c4168211135263980ba6
6
+ metadata.gz: c8ff6b069089defb72497b5431ac790a59b019253fc10f2f6c5562184b6f42bb5457a28264efd19f3e1d5f1801c28e068f0c4315ddbaec8e8155cad3e13855b6
7
+ data.tar.gz: 6552a2df9438f6e7b3c9737ae814d61d835446396ad9ef0777eb805680923aa47e0b90de15662388dcde3baab3ae0640df35d79223f656f1335accbdcde64266
@@ -82,11 +82,25 @@ module Servactory
82
82
  common_condition_with(...)
83
83
  end
84
84
 
85
- def common_condition_with(value:, option:, **)
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
 
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 2
6
6
  MINOR = 6
7
- PATCH = 1
7
+ PATCH = 2
8
8
  PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
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.1
4
+ version: 2.6.2
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-05-15 00:00:00.000000000 Z
11
+ date: 2024-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport