active_record_store 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/ar_store.rb +2 -2
- data/lib/active_record_store/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: 788cd7f78ac5e062907fb7dc699def303cb293b7
|
4
|
+
data.tar.gz: d098b1e88168b8fe55f84c23bfad96b6b5021c70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564ade1c92a2eb420d5b98dec76ae16fceb3115bcc1d1f8d31d808da574f6dba69fa12f975e0b765739d8be300b556c12660411d8ed74014d34d17d0f793734f
|
7
|
+
data.tar.gz: ba76245525655aff127aac4a20cec466db418735e8680a2095aeaf66672a3b3dc738c461283ba3ca95d22dbdd670248ca13f30d2ab859959de79556a6682e2cf
|
data/app/models/ar_store.rb
CHANGED
@@ -30,14 +30,14 @@ class ArStore < ActiveRecord::Base
|
|
30
30
|
options.symbolize_keys!
|
31
31
|
raise ArgumentError "expires_in is the only valid option" if invalid_options(options).present?
|
32
32
|
raise ArgumentError, "Pass value or a block, not both" if value && block_given?
|
33
|
-
(get(key) || new).write!(key, (value
|
33
|
+
(get(key) || new).write!(key, (value.nil? ? yield : value), options[:expires_in])
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.fetch(key, value = nil, options = {}, &blk)
|
37
37
|
options.symbolize_keys!
|
38
38
|
raise ArgumentError "expires_in is the only valid option" if invalid_options(options).present?
|
39
39
|
raise ArgumentError, "Pass value or a block, not both" if value && block_given?
|
40
|
-
read(key) || new.write!(key, (value
|
40
|
+
read(key) || new.write!(key, (value.nil? ? yield : value), options[:expires_in])
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.clean
|