support_table_cache 1.1.0 → 1.1.1

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: d66ca180334bd4b561b514dab26606f7ddc0979136a3cbca0479982734ad5703
4
- data.tar.gz: 0e156f0ea38520098710748d1e5ecad71df3aecdb0df4ff78f8be92d075dbd3f
3
+ metadata.gz: a4593056e89633a124e0301d60245fd7ce398d30c4e4df6bb83d0a982618e7e6
4
+ data.tar.gz: 4a145eb106e73e8005df79dfff194fdfd1a6712a0452c5c782665321fc4f5e31
5
5
  SHA512:
6
- metadata.gz: 1f3b29d73e1cb683689888513b87ae6ceff74c871744ebdb30bb271789b6c4942355c773de4fad80a0d5f4d65f35462b3d49043f7119858a725ce39243e74e47
7
- data.tar.gz: 9a2b3e9d9a79f3b91178f1218668d4b6d388397e85e7863e4e4746a9e89d934c3e012a6d709099671073dd2e03035842d22fcb9e15c9b8ad3cf2062cc56074d3
6
+ metadata.gz: d11be8910f52e30c5c7b4cdb0eb9acbb0d0c0c4921ab3eba158111ebdd9635a91387f1d440d7ccc9fdb1136b4482a0110811ba6c86eb620443011c0aa9a00b14
7
+ data.tar.gz: 99df1e4070ed392e85dcb711c8cddf253733faf505d0b54d6288fb23a1c9eac67230a1a71ea05e73035133ae4fd519c0e1d9d94eb6d4d095f425faf1ca544a02
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 1.1.1
8
+
9
+ ### Fixed
10
+ - Fixed disabled and disable_cache methods to yield a block to match the documentation.
11
+
7
12
  ## 1.1.0
8
13
 
9
14
  ### Added
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
@@ -6,10 +6,10 @@ module SupportTableCache
6
6
  # Override for the find_by method that looks in the cache first.
7
7
  def find_by(*args)
8
8
  cache = current_support_table_cache
9
- return super if cache.nil?
9
+ return super unless cache
10
10
 
11
11
  cache_key = nil
12
- attributes = (args.size == 1 && args.first.is_a?(Hash) ? args.first.stringify_keys : {})
12
+ attributes = ((args.size == 1 && args.first.is_a?(Hash)) ? args.first.stringify_keys : {})
13
13
 
14
14
  if respond_to?(:scope_attributes) && scope_attributes.present?
15
15
  attributes = scope_attributes.stringify_keys.merge(attributes)
@@ -9,10 +9,10 @@ module SupportTableCache
9
9
  return super unless klass.include?(SupportTableCache)
10
10
 
11
11
  cache = klass.send(:current_support_table_cache)
12
- return super if cache.nil?
12
+ return super unless cache
13
13
 
14
14
  cache_key = nil
15
- attributes = (args.size == 1 && args.first.is_a?(Hash) ? args.first.stringify_keys : {})
15
+ attributes = ((args.size == 1 && args.first.is_a?(Hash)) ? args.first.stringify_keys : {})
16
16
 
17
17
  # Apply any attributes from the current relation chain
18
18
  if scope_attributes.present?
@@ -45,6 +45,7 @@ module SupportTableCache
45
45
  save_val = Thread.current.thread_variable_get(varname)
46
46
  begin
47
47
  Thread.current.thread_variable_set(varname, !!disabled)
48
+ yield
48
49
  ensure
49
50
  Thread.current.thread_variable_set(varname, save_val)
50
51
  end
@@ -53,8 +54,8 @@ module SupportTableCache
53
54
  # Enable the caching behavior for this class within the block. The enabled setting
54
55
  # for a class will always take precedence over the global setting.
55
56
  #
56
- # @return [void]
57
- def enable_cache
57
+ # @yieldreturn The return value of the block.
58
+ def enable_cache(&block)
58
59
  disable_cache(false, &block)
59
60
  end
60
61
 
@@ -133,7 +134,7 @@ module SupportTableCache
133
134
  end
134
135
 
135
136
  def current_support_table_cache
136
- return nil? if support_table_cache_disabled?
137
+ return nil if support_table_cache_disabled?
137
138
  SupportTableCache.testing_cache || support_table_cache_impl || SupportTableCache.cache
138
139
  end
139
140
  end
@@ -149,6 +150,7 @@ module SupportTableCache
149
150
  save_val = Thread.current.thread_variable_get(:support_table_cache_disabled)
150
151
  begin
151
152
  Thread.current.thread_variable_set(:support_table_cache_disabled, !!disabled)
153
+ yield
152
154
  ensure
153
155
  Thread.current.thread_variable_set(:support_table_cache_disabled, save_val)
154
156
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: support_table_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-02 00:00:00.000000000 Z
11
+ date: 2022-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord