database_consistency 1.7.9 → 1.7.11

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: 199d6a4e4c313048e4e1abf5e980fec96d4703704a837024fbb6e507ab36bc7f
4
- data.tar.gz: db33237e3cc031b90ebae5001a4d99b5c398f6a2324d6016275b8501b2f39e10
3
+ metadata.gz: bf8618ba8f3e8311f6cfe28281eb840f72fb389267d23c7df8dacceb81466856
4
+ data.tar.gz: 14b60dbacd605899a0f1e5c95147b1f879d36ff70bcf761f867412697093d552
5
5
  SHA512:
6
- metadata.gz: 30639e1cfed1a67db161d01dcd1fd8d1f2511fcb062bebb9371a9a690d2054ae5936fb13a0a158db26c2bcb60b89560c1fd17a936c402ae72e62a7c611a732ee
7
- data.tar.gz: 6b891e83dd31d2a9fcfb76ac53d3aa1186e203daebb27c252084cf7208cfa0c3f091dbbe92cb63cb98b0dc48f2939718b6fc85a9f72430e79a9882799c6b1a94
6
+ metadata.gz: 368509ce28357a3817a1f8c05233db99b9baa451b70e28fc484d2ea87e1745de08a65c0aff88dfc71d730b8fcd5932565b685b97d1a32b224faf9f494413055c
7
+ data.tar.gz: d8f1272dfabd6d7531efe1d37fd13924bedf734bf4def4274c24c8bc0d85e616a6b2c391e8594f32051e3a5cba15cb19d3aab2c6a8b682d48b1d928f21c95c00
@@ -86,9 +86,7 @@ module DatabaseConsistency
86
86
  end
87
87
 
88
88
  def index_keys(index, limit: nil)
89
- return unless index.columns.is_a?(Array)
90
-
91
- columns = index.columns
89
+ columns = Helper.extract_index_columns(index.columns)
92
90
 
93
91
  if limit
94
92
  columns.first(limit).sort
@@ -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.9'
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.9
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-22 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