rails-settings-cached 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fba2dd4d13c0c1a77876382d0207c0815a75d34
4
- data.tar.gz: b1ccc3d46ba88211fd29952b0eabf020cef3acab
3
+ metadata.gz: 4a39928c852dc7324af7486277203647a7b325bd
4
+ data.tar.gz: 002dc0d372dd40be1fbca78c0d50e8fd22cee335
5
5
  SHA512:
6
- metadata.gz: a0342009a9dc86b0f531583cb3de8137944641e8d667acb486b739f7b4bbb4bb611dd33511c7ef41fc6a77a72ea7b842d20f79ee8f3f915d7e9bc03d3c4d618e
7
- data.tar.gz: 54a0558fee9b43f595801fbe84c40e6907ddc226eeeedbeed458dc466cf2bea35532d6603728cc4e6222948d68528cdc3dee46c26c5cf1dde0f43dca773585ad
6
+ metadata.gz: 3e7a7d055e200c97d604a4bfdf8576dfc8504bcee559a1c1fc471d4b69f859d7756b9ae3b0531111aa2d233be65a0ba901a166445235626613555713934775e7
7
+ data.tar.gz: fc9bf7d4d30a2060f8b22a800682834901c4cedd2551332ed07c12a0af70dca3ab9a3af4b2105572f43397bf94c9c26f94565852692f0c451160528f00ba1f1c
@@ -20,11 +20,15 @@ module RailsSettings
20
20
  end
21
21
 
22
22
  def [](var_name)
23
- obj = Rails.cache.read(cache_key(var_name, @object))
24
- obj = super(var_name) if obj.nil?
23
+ value = Rails.cache.fetch(cache_key(var_name, @object)) do
24
+ super(var_name)
25
+ end
25
26
 
26
- return @@defaults[var_name.to_s] if obj.nil?
27
- obj
27
+ if value.nil?
28
+ @@defaults[var_name.to_s] if value.nil?
29
+ else
30
+ value
31
+ end
28
32
  end
29
33
 
30
34
  def save_default(key, value)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-settings-cached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Squeegy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-09-14 00:00:00.000000000 Z
14
+ date: 2015-09-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -27,6 +27,20 @@ dependencies:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: 4.2.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: rspec
32
46
  requirement: !ruby/object:Gem::Requirement