database_consistency 2.0.7 → 2.0.8

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: 8aa53651a6fab582987c49a3667bb618bf97f9f8cc48418a6c7fc0e22457104c
4
- data.tar.gz: 7d23f15f92702e6d4bea909a5b267265da71f331653dae27d987441596806e9d
3
+ metadata.gz: 3093f4a5d4db53c187939d87a5799b5a932d9ddb6d7c4d124949e66e2ea14477
4
+ data.tar.gz: d7c73224a9f1006113ad57b8a6a740f5198bcbe2ba7b855cdaac9d34b8794f87
5
5
  SHA512:
6
- metadata.gz: fe01102c680e3439282bc24e7e5d98ae2ff8a14eac30339500b912902b70f9c2069d284753cd9db768d9cb1ed0c91d31332af92082ca87f01be104e10f0cc226
7
- data.tar.gz: 7dabf536ab2825e6eae778dc97edca36c56eba676647856e05a3c287d28248287cf7f6918f563f6e1022712822719037525faf029de4a89d551439a95c6df225
6
+ metadata.gz: e0b3a3e3507c77692ffcd1b89430e561bf9c51f1d5419ab5cd176667048c747d03bf9ca0789a60bd02e5e2deac6e666556f0d1c4cc95c666c66b4ee48562e0f6
7
+ data.tar.gz: 3fa45f23b358a9ce3ab83be7512c6ec7d59c9ae6bf7b5ec39c50f26ddaa0063fb7a31dd2779d67e946222ef7aea0186d1ad1b7383a4c482424b01c6dda1348b4
@@ -69,7 +69,7 @@ module DatabaseConsistency
69
69
  model.validators.any? do |validator|
70
70
  validator.kind == :exclusion &&
71
71
  Helper.check_inclusion?(validator.attributes, column.name) &&
72
- validator.options[:in].include?(nil)
72
+ Helper.inclusion_validator_values(validator).include?(nil)
73
73
  end
74
74
  end
75
75
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module DatabaseConsistency
4
4
  # The module contains helper methods
5
- module Helper
5
+ module Helper # rubocop:disable Metrics/ModuleLength
6
6
  module_function
7
7
 
8
8
  def adapter
@@ -112,6 +112,16 @@ module DatabaseConsistency
112
112
  end
113
113
  end
114
114
 
115
+ def inclusion_validator_values(validator)
116
+ value = validator.options[:in]
117
+
118
+ if value.is_a?(Proc) && value.arity.zero?
119
+ value.call
120
+ else
121
+ Array.wrap(value)
122
+ end
123
+ end
124
+
115
125
  def btree_index?(index)
116
126
  (index.type.nil? || index.type.to_s == 'btree') &&
117
127
  (index.using.nil? || index.using.to_s == 'btree')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '2.0.7'
4
+ VERSION = '2.0.8'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_consistency
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-07 00:00:00.000000000 Z
11
+ date: 2025-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord