active_remote-cached 0.0.1 → 0.0.2

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: 5d24644649d050e9d4e4bf6164b050a30551a146
4
- data.tar.gz: ff66a84b00c10d48fcf6bca41b50193f961b2b7f
3
+ metadata.gz: f7d2d905a1f2c332e672714d359026c4cdbfbbb8
4
+ data.tar.gz: c8d4806770678aa49d193ad6fea044817d763b04
5
5
  SHA512:
6
- metadata.gz: 222352b851868aedc14f66832239056f81a7f467f902f682f0ca2500d70296162bace6cc7144a2758bff153d5582f3fb0aed53886d0f48d30b7c8045bb060c38
7
- data.tar.gz: f39cb8f7a1101dc3c92afc49c9d9c21b4cc460a850ef4b589dd53a387b732bfa48577bfccc8b9f238e5a5114c8d61e6d20cfb0975990b677493c457b3a377d08
6
+ metadata.gz: 0846621184ac0a101620381a333fef148fef114d488d61adb0dada6ba55c8b53f77ba00d38fee49ba63f6ac145a270ab4fbc503c7066f46075687612a7dda39f
7
+ data.tar.gz: 946302d6ada16ec640746c057916fe10361a004c14b1d13afdce699070a8e34eb154d545683cecfe7314a1154bba3a977901824e21b0f821882a6de01fc7605a
@@ -7,7 +7,6 @@ module ActiveRemote::Cached
7
7
  def initialize(new_cache_provider)
8
8
  @cache_provider = new_cache_provider
9
9
  validate_provider_method_present(:delete)
10
- validate_provider_method_present(:exist?)
11
10
  validate_provider_method_present(:fetch)
12
11
  validate_provider_method_present(:read)
13
12
  validate_provider_method_present(:write)
@@ -15,6 +14,14 @@ module ActiveRemote::Cached
15
14
  super(@cache_provider)
16
15
  end
17
16
 
17
+ def exist?(key)
18
+ if self.cache_provider.respond_to?(:exist?)
19
+ self.cache_provider.exist?(key)
20
+ else
21
+ !self.cache_provider.read(key).nil?
22
+ end
23
+ end
24
+
18
25
  private
19
26
 
20
27
  def validate_provider_method_present(method_name)
@@ -1,5 +1,5 @@
1
1
  module ActiveRemote
2
2
  module Cached
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -20,12 +20,6 @@ describe ::ActiveRemote::Cached::Cache do
20
20
  error.message.must_match(/respond_to.*delete/i)
21
21
  end
22
22
 
23
- it "validates #exist? present" do
24
- cache = OpenStruct.new(:write => nil, :fetch => nil, :read => nil, :delete => nil)
25
- error = lambda { ::ActiveRemote::Cached.cache(cache) }.must_raise(RuntimeError)
26
- error.message.must_match(/respond_to.*exist/i)
27
- end
28
-
29
23
  it "validates #fetch present" do
30
24
  cache = OpenStruct.new(:write => nil, :delete => nil, :read => nil, :exist? => nil)
31
25
  error = lambda { ::ActiveRemote::Cached.cache(cache) }.must_raise(RuntimeError)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_remote-cached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dewitt