database_consistency 1.7.10 → 1.7.11

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: 672d4b81b5aa399e767e013289f7b7c5242fa60d4e6bb2776cbc62cfd56afd08
4
- data.tar.gz: e044d16e669c3f3f32f5a8076632848ea0bcd7ebee9f40dd015de8168dea177f
3
+ metadata.gz: bf8618ba8f3e8311f6cfe28281eb840f72fb389267d23c7df8dacceb81466856
4
+ data.tar.gz: 14b60dbacd605899a0f1e5c95147b1f879d36ff70bcf761f867412697093d552
5
5
  SHA512:
6
- metadata.gz: d908a7880fa77d923569d67f46c8129ba26348e26beaf73f3fe4e3a2d35cf2d31a2053321063c423d6e166453b577fb04048ec5d1056c11f6324a98168d202f9
7
- data.tar.gz: 00615f95cbe9d16a3578b3ab0568d06c0a779f442d3e4bc2402be3ddd7a9c52f748fe04c67cec027c0b937c508932b415b2acc9f4d9d4fa3f6d45ff14d37a4c2
6
+ metadata.gz: 368509ce28357a3817a1f8c05233db99b9baa451b70e28fc484d2ea87e1745de08a65c0aff88dfc71d730b8fcd5932565b685b97d1a32b224faf9f494413055c
7
+ data.tar.gz: d8f1272dfabd6d7531efe1d37fd13924bedf734bf4def4274c24c8bc0d85e616a6b2c391e8594f32051e3a5cba15cb19d3aab2c6a8b682d48b1d928f21c95c00
@@ -33,7 +33,7 @@ module DatabaseConsistency
33
33
  value = global_enabling
34
34
 
35
35
  path.each do |key|
36
- current = current[key.to_s]
36
+ current = find(key.to_s, current)
37
37
  return value unless current.is_a?(Hash)
38
38
 
39
39
  next if current['enabled'].nil?
@@ -48,6 +48,16 @@ module DatabaseConsistency
48
48
 
49
49
  attr_reader :configuration
50
50
 
51
+ def find(key, configuration)
52
+ return configuration[key] if configuration.key?(key)
53
+
54
+ configuration.find { |(k, _)| k.include?('*') && key.match?(generate_regexp(k)) }&.last
55
+ end
56
+
57
+ def generate_regexp(str)
58
+ /\A#{str.gsub('*', '.*')}\z/
59
+ end
60
+
51
61
  def existing_configurations(paths)
52
62
  Array(paths).select do |filepath|
53
63
  filepath && File.exist?(filepath)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.7.10'
4
+ VERSION = '1.7.11'
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: 1.7.10
4
+ version: 1.7.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-24 00:00:00.000000000 Z
11
+ date: 2023-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -264,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
264
  - !ruby/object:Gem::Version
265
265
  version: '0'
266
266
  requirements: []
267
- rubygems_version: 3.0.3.1
267
+ rubygems_version: 3.1.6
268
268
  signing_key:
269
269
  specification_version: 4
270
270
  summary: Provide an easy way to check the consistency of the database constraints