active_tools 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_tools/core_extension/runtime_caching.rb +3 -17
- data/lib/active_tools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c1be17343f6cf26e6a8767ede3d1aa9bf6847f3
|
4
|
+
data.tar.gz: c3928bee99ed3aa209434a4599abc8cec63786d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f85e540f8fd2d99f9adc178cd98a2277929492bdabc742bcc5cfea5cdf99993dfb1c6d81c99b543b750db0b894aba5c84eff39459af15edf2088923bd4f88ac6
|
7
|
+
data.tar.gz: e9f09dcb08519d767a328dd294e24ff31fd704459b721b811afafbb7d01430e15d5adeca5b6b84080cfaffca794e3d09e7ec68da880bd032c40ccfa37d1e9f42
|
@@ -3,28 +3,14 @@ module ActiveTools
|
|
3
3
|
module RuntimeCaching
|
4
4
|
def acts_as_runtime_caching(*args)
|
5
5
|
options = args.extract_options!
|
6
|
-
|
7
|
-
thread_key = options[:thread_key]||::SecureRandom.urlsafe_base64(nil, false).to_sym
|
8
|
-
send(:include, ::Singleton)
|
9
|
-
container = Class.new
|
10
|
-
container.send(:include, ::ActiveSupport::Configurable)
|
11
|
-
container.instance_eval do
|
12
|
-
config_accessor *accessors
|
13
|
-
end
|
14
|
-
define_method :config do
|
15
|
-
::Thread.current[thread_key] ||= container.new
|
16
|
-
end
|
17
|
-
define_method :"config=" do |value|
|
18
|
-
::Thread.current[thread_key] = value
|
19
|
-
end
|
20
|
-
accessors.each do |method|
|
6
|
+
args.each do |method|
|
21
7
|
instance_eval <<-DELEGATORS
|
22
8
|
def #{method}
|
23
|
-
|
9
|
+
::Thread.current[:#{method}]
|
24
10
|
end
|
25
11
|
|
26
12
|
def #{method}=(value)
|
27
|
-
|
13
|
+
::Thread.current[:#{method}] = (value)
|
28
14
|
end
|
29
15
|
DELEGATORS
|
30
16
|
end
|
data/lib/active_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valery Kvon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|