rod-rest 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.txt +2 -0
- data/lib/rod/rest/constants.rb +1 -1
- data/lib/rod/rest/proxy_cache.rb +5 -8
- metadata +2 -2
data/changelog.txt
CHANGED
data/lib/rod/rest/constants.rb
CHANGED
data/lib/rod/rest/proxy_cache.rb
CHANGED
@@ -5,25 +5,22 @@ module Rod
|
|
5
5
|
# Cache used to store proxy objects.
|
6
6
|
class ProxyCache
|
7
7
|
# Initializes empty cache.
|
8
|
-
def initialize()
|
9
|
-
@cache_implementation =
|
8
|
+
def initialize(cache_implementation={})
|
9
|
+
@cache_implementation = cache_implementation
|
10
10
|
end
|
11
11
|
|
12
12
|
# Returns true if the described object is in the cache.
|
13
13
|
def has_key?(description)
|
14
14
|
check_description(description)
|
15
|
-
@cache_implementation
|
15
|
+
@cache_implementation[description_signature(description)]
|
16
16
|
end
|
17
17
|
|
18
18
|
# Returns the object stored in the cache. Raises CacheMissed exception if
|
19
19
|
# the result is nil.
|
20
20
|
def [](description)
|
21
21
|
check_description(description)
|
22
|
-
|
23
|
-
|
24
|
-
rescue KeyError
|
25
|
-
raise CacheMissed.new(missing_entry_message(description))
|
26
|
-
end
|
22
|
+
value = @cache_implementation[description_signature(description)]
|
23
|
+
raise CacheMissed.new(missing_entry_message(description)) if value.nil?
|
27
24
|
end
|
28
25
|
|
29
26
|
# Store the +object+ in the cache.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rod-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|