lock_and_cache 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/README.md +6 -6
- data/lib/lock_and_cache/key.rb +1 -1
- data/lib/lock_and_cache/version.rb +1 -1
- data/spec/lock_and_cache_spec.rb +10 -0
- 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: 53114479afcfb77e10b908ebeb5a5782901da5e3
|
4
|
+
data.tar.gz: 1a63e3ff7d3587fff5d7b993be8e64554c57667e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0ee726d8786273725fb3062f288b0d4ac312c6a900afa19746218dcd74b45dc364b60a70dd25026666519e76e2837b725ccc5c6b400e8f5e7b74ae7ea6ff0fd
|
7
|
+
data.tar.gz: c8ed47d57ff8c145cf50d66bdb00cedce5a40d7a2c7c461e1d5ec286a849578a20145c56f6853f6b148cfbaaca3c9b3047ef4d13b305572d6af66433869544ec
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# LockAndCache
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/seamusabshere/lock_and_cache.svg?branch=master)](https://travis-ci.org/seamusabshere/lock_and_cache)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/seamusabshere/lock_and_cache/badges/gpa.svg)](https://codeclimate.com/github/seamusabshere/lock_and_cache)
|
5
|
-
[![Dependency Status](https://gemnasium.com/seamusabshere/lock_and_cache.svg)](https://gemnasium.com/seamusabshere/lock_and_cache)
|
6
|
-
[![Gem Version](https://badge.fury.io/rb/lock_and_cache.svg)](http://badge.fury.io/rb/lock_and_cache)
|
7
|
-
[![Security](https://hakiri.io/github/seamusabshere/lock_and_cache/master.svg)](https://hakiri.io/github/seamusabshere/lock_and_cache/master)
|
8
|
-
[![Inline docs](http://inch-ci.org/github/seamusabshere/lock_and_cache.svg?branch=master)](http://inch-ci.org/github/seamusabshere/lock_and_cache)
|
3
|
+
[![Build Status](https://travis-ci.org/seamusabshere/lock_and_cache.svg?branch=master&v=2.2.0)](https://travis-ci.org/seamusabshere/lock_and_cache)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/seamusabshere/lock_and_cache/badges/gpa.svg?v=2.2.0)](https://codeclimate.com/github/seamusabshere/lock_and_cache)
|
5
|
+
[![Dependency Status](https://gemnasium.com/seamusabshere/lock_and_cache.svg?v=2.2.0)](https://gemnasium.com/seamusabshere/lock_and_cache)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/lock_and_cache.svg?v=2.2.0)](http://badge.fury.io/rb/lock_and_cache)
|
7
|
+
[![Security](https://hakiri.io/github/seamusabshere/lock_and_cache/master.svg?v=2.2.0)](https://hakiri.io/github/seamusabshere/lock_and_cache/master)
|
8
|
+
[![Inline docs](http://inch-ci.org/github/seamusabshere/lock_and_cache.svg?branch=master&v=2.2.0)](http://inch-ci.org/github/seamusabshere/lock_and_cache)
|
9
9
|
|
10
10
|
Lock and cache using redis!
|
11
11
|
|
data/lib/lock_and_cache/key.rb
CHANGED
@@ -15,7 +15,7 @@ module LockAndCache
|
|
15
15
|
#
|
16
16
|
# Get a context object's class name, which is its own name if it's an object.
|
17
17
|
def extract_class_name(context)
|
18
|
-
(
|
18
|
+
(context.class == ::Class) ? context.name : context.class.name
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
data/spec/lock_and_cache_spec.rb
CHANGED
@@ -287,6 +287,16 @@ describe LockAndCache do
|
|
287
287
|
expect(count).to eq(2)
|
288
288
|
end
|
289
289
|
|
290
|
+
it 'can be nested' do
|
291
|
+
expect(LockAndCache.lock_and_cache('hello') do
|
292
|
+
LockAndCache.lock_and_cache('world') do
|
293
|
+
LockAndCache.lock_and_cache('privyet') do
|
294
|
+
123
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end).to eq(123)
|
298
|
+
end
|
299
|
+
|
290
300
|
it "requires a key" do
|
291
301
|
expect do
|
292
302
|
LockAndCache.lock_and_cache do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lock_and_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seamus Abshere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|