active_memoize 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_memoize/cache.rb +4 -1
- data/lib/active_memoize/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 825d56d2f91c7f4e6410adb6a0954bb30e011633b1802dc37ce6ca619ecf4b4e
|
4
|
+
data.tar.gz: 11ce236a5ba5172b378c449b4c291ede92ec9c88d32b483d54f014ca76ded3a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 119719ab6e15811eaaada9272bedfbb369c062fe06c762ce9b9ac3b71c17b66e9df49ce2e56b439eec93f86b67312fa3c8c151290f8cfc2a2ae0f454e97b4e6c
|
7
|
+
data.tar.gz: fec75cbb9dc8248017f58fc43b58ad261a86f42d9e4f1dd0962c6f210b1948a259924fc2ef9ac64b2fa5e0488748b90b7901d5549d2194b24f432f07b27206c8
|
data/lib/active_memoize/cache.rb
CHANGED
@@ -54,7 +54,10 @@ module ActiveMemoize
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def memoize(&block)
|
57
|
-
|
57
|
+
method_locals = caller_locals(block)
|
58
|
+
method_name = caller_method
|
59
|
+
method_name = "#{caller_method}:#{method_locals}" unless method_locals.nil?
|
60
|
+
|
58
61
|
return @cache[method_name] if @cache.key?(method_name)
|
59
62
|
|
60
63
|
@cache[method_name] = yield(block)
|