request_store_rails 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: 65b187ecf5b7f10f2e21e2b6da37f360ea75fa5e
4
- data.tar.gz: 1c51bb08533fc494f9ceaeae439fa0034b17cf34
3
+ metadata.gz: 6b370ace6ec755d1dc7fa029ee24f92eb5b9caac
4
+ data.tar.gz: 59be0018678daaa9cf65c25305c8170fc41a9055
5
5
  SHA512:
6
- metadata.gz: 5584425e010aa796fde16d7fd9f4e21324e25d477c430a7067279526c742776510ccebc4e1e986b7624f579b19435a647c12cc9b81ce6c6bceb6c6d6d4d3b81b
7
- data.tar.gz: 5e0cfb417c9ae43ec4de136b64d4e61db7652ddbb426359b07a4da92dfc69e508f3ff473a094aa51c72111950b66be7e0eaaa948cf3099e014d08d1049c1c633
6
+ metadata.gz: ff35f1f352936ce0858d15ec30b4e996a7e70e7d62a31137c0303000d1c374a1efa3e02ac6b03f4a7b9822297a693fc96c799ec002167ad32648a3383519349a
7
+ data.tar.gz: 188fda858dd967a796197b6989e16ef88878eafe72d69dd61282b02cca96487168ea3fc7dc4824f89453261f3e7518ad46f9870c5b92f1d901b6100d1a4bd338
data/README.md CHANGED
@@ -121,6 +121,18 @@ while `RequestLocal[:foo] ||= 'default'` is not. In most scenarios, there is not
121
121
  a lot of difference, but if you are in a concurrent environment make sure to
122
122
  use the one that is more suitable for your use case :wink:
123
123
 
124
+ ## Replacing `request_store`
125
+ While the plan is not to achieve 100% compatibility, this gem usually works well
126
+ as a drop-in replacement. If you are using gems that rely on `RequestStore` but
127
+ for some reason you need them to use the appropriate request/thread scope, you
128
+ can try something like this on `application.rb` or similar:3
129
+ ```ruby
130
+ if RequestStore != RequestLocals
131
+ RequestStore::Railtie.initializers.clear
132
+ Kernel.suppress_warnings { RequestStore = RequestLocals }
133
+ end
134
+ ```
135
+
124
136
  ## Special Thanks
125
137
  The inspiration for this gem, tests, and a big part of the readme were borrowed
126
138
  from the really cool [`request_store`](https://github.com/steveklabnik/request_store) gem.
@@ -18,7 +18,7 @@ class RequestLocals
18
18
  extend Forwardable
19
19
 
20
20
  # Public: Public methods of RequestLocals, they are delegated to the Singleton instance.
21
- def_delegators :instance, :clear!, :clear_all!, :[], :[]=, :fetch, :delete, :exist?, :empty?
21
+ def_delegators :instance, :clear!, :clear_all!, :[], :[]=, :fetch, :delete, :exist?, :key?, :empty?
22
22
 
23
23
  # Public: There is no accounting for taste, RequestLocals[:foo] vs RequestLocals.store[:foo]
24
24
  alias_method :store, :instance
@@ -63,6 +63,9 @@ class RequestLocals
63
63
  store.key?(key)
64
64
  end
65
65
 
66
+ # Public: Alias to exist?
67
+ alias_method :key?, :exist?
68
+
66
69
  # Public: Implements fetch in a consistent way with Rails.cache, persisting
67
70
  # the value yielded by the block if the key was not found.
68
71
  #
@@ -1,4 +1,4 @@
1
1
  module RequestStoreRails
2
2
 
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request_store_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-25 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  requirements: []
89
89
  rubyforge_project:
90
- rubygems_version: 2.5.1
90
+ rubygems_version: 2.6.11
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Per-request global storage for Rails