request_store_rails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/request_locals.rb +5 -3
- data/lib/request_store_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b17ce75ce44d00e22a3c88e3d2200714b3ede747
|
4
|
+
data.tar.gz: f0b63afb4d88307e211734be8f07312ee39112ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1dfc33174e4ef819694d9d92f0c657832a0a273cb4d61486f20d22f825b69c9fcc371320bdceafd0fb8f151a84d2a06731fd12964a759fe0a9c7f849201caae
|
7
|
+
data.tar.gz: c3fa2ee4a89e114d0ccfa10807070b6e4a79facfe6a01c24f38c7ba124462559ae7dc60f50c41bb28b15bace7921cd1f8d38c391ee4ee611a0807f29643ef064
|
data/lib/request_locals.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'singleton'
|
2
|
+
require 'forwardable'
|
2
3
|
require 'thread_safe'
|
3
|
-
require 'active_support/core_ext/module/delegation'
|
4
4
|
|
5
5
|
# Public: Provides per-request global storage, by offering an interface that is
|
6
6
|
# very similar to Rails.cache, or Hash.
|
@@ -12,11 +12,13 @@ require 'active_support/core_ext/module/delegation'
|
|
12
12
|
# will clear the request local variables after each request.
|
13
13
|
class RequestLocals
|
14
14
|
include Singleton
|
15
|
+
extend Forwardable
|
15
16
|
|
16
17
|
class << self
|
18
|
+
extend Forwardable
|
17
19
|
|
18
20
|
# Public: Public methods of RequestLocals, they are delegated to the Singleton instance.
|
19
|
-
|
21
|
+
def_delegators :instance, :clear!, :clear_all!, :[], :[]=, :fetch, :delete, :exist?, :empty?
|
20
22
|
|
21
23
|
# Public: There is no accounting for taste, RequestLocals[:foo] vs RequestLocals.store[:foo]
|
22
24
|
alias_method :store, :instance
|
@@ -26,7 +28,7 @@ class RequestLocals
|
|
26
28
|
end
|
27
29
|
|
28
30
|
# Internal: Methods of the RequestLocals instance, delegated to the request-local structure.
|
29
|
-
|
31
|
+
def_delegators :store, :[], :[]=, :delete, :empty?
|
30
32
|
|
31
33
|
def initialize
|
32
34
|
@cache = ThreadSafe::Cache.new
|