servactory 2.6.0.rc2 → 2.6.0.rc4

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: 3f69f28208e5c09f4ddd0e112ca8155ef288af67b5bc2c7035f12082ab968acc
4
- data.tar.gz: 97820e7d44399d15b077091e4c7eb3956444a7e456dd6a8e51fd49caa21b7431
3
+ metadata.gz: 53d70d5438c6e58daf86d416c2910eabe04727880af9189b7813da17bd3bb777
4
+ data.tar.gz: cbab6d80c1d012d80d72f5f76eaa3fd17d01af568961d0eaf16a80abfc61591a
5
5
  SHA512:
6
- metadata.gz: 4bcf546de124b1d5cae91b2b9288a6a68ce0fcbab0a343166a112505df3671f6f5d33aa5dcd600b8f98f2ef51e7b457bf272ffc43fab6bd5b9c050f938db2e93
7
- data.tar.gz: 89022378fefc711217f6ec2176613b4beaa3b16e6afe3ae01f0c73e3462f32f3c50dd746db2abd61eb2cc97ada91f7925001b5492ceacd9a73b0dcfdf7e6ae3a
6
+ metadata.gz: 2ec8ed69eaa089a441280c3f0650b842509175f9d14b25a2f838fd61e4e60ca622e24e65a76d7303f8b041f070eb6cd17f51cb959b1ceef9f809cadbe8e4d492
7
+ data.tar.gz: d96fd4a4a3864a4654e80802451ee003cffc5e3d609d368667790fea4c1511162de0f06491906d9e7e49e3f878c72cda870b28848150b01c84a6eb92df2d325f
@@ -26,14 +26,15 @@ module Servactory
26
26
  def common_condition_with(attribute:, value:, option:)
27
27
  return true if option.value == false
28
28
  return false if COLLECTION_CLASS_NAMES.intersection(attribute.types).empty?
29
+ return true if attribute.input? && attribute.optional? && value.blank?
29
30
 
30
31
  validate_for!(values: value, option: option)
31
32
  end
32
33
 
33
- def validate_for!(values:, option:)
34
+ def validate_for!(values:, option:) # rubocop:disable Metrics/CyclomaticComplexity
34
35
  consists_of_types = Array(option.value)
35
36
 
36
- return [false, :required] if !consists_of_types.include?(NilClass) && !values.flatten.all?(&:present?)
37
+ return [false, :required] if !consists_of_types.include?(NilClass) && !values&.flatten&.all?(&:present?)
37
38
 
38
39
  return true if values.flatten.all? do |value|
39
40
  consists_of_types.include?(value.class)
@@ -84,6 +85,8 @@ module Servactory
84
85
  end
85
86
 
86
87
  def given_type_for(values:, option_value:)
88
+ return nil if values.nil?
89
+
87
90
  values.flatten.filter { |value| Array(option_value).exclude?(value.class) }.map(&:class).uniq.join(", ")
88
91
  end
89
92
  end
@@ -5,7 +5,7 @@ module Servactory
5
5
  MAJOR = 2
6
6
  MINOR = 6
7
7
  PATCH = 0
8
- PRE = "rc2"
8
+ PRE = "rc4"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  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: 2.6.0.rc2
4
+ version: 2.6.0.rc4
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-10 00:00:00.000000000 Z
11
+ date: 2024-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport