Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename Kernel#memoize to Kernel#expirable_memoize so that it doesn't …

…conflict with memoize method in ActiveSupport which has an entirely different API and semantics. Reported by [Florian Dütsc (mail@florian-duetsch.de)].
  • Loading branch information...
commit af27b54b69cb502e5d0adff6430f9cc04c680084 1 parent 3f148e1
@marcel marcel authored
View
4 lib/aws/s3/acl.rb
@@ -528,7 +528,7 @@ def acl(name = nil, policy = nil)
# bucket.acl(bucket.acl)
def acl(reload = false)
policy = reload.is_a?(ACL::Policy) ? reload : nil
- memoize(reload) do
+ expirable_memoize(reload) do
self.class.acl(name, policy) if policy
self.class.acl(name)
end
@@ -579,7 +579,7 @@ def acl(name, bucket = nil, policy = nil)
# object.acl(object.acl)
def acl(reload = false)
policy = reload.is_a?(ACL::Policy) ? reload : nil
- memoize(reload) do
+ expirable_memoize(reload) do
self.class.acl(key, bucket.name, policy) if policy
self.class.acl(key, bucket.name)
end
View
4 lib/aws/s3/extensions.rb
@@ -133,7 +133,7 @@ def __called_from__
caller[1][/`([^']+)'/, 1]
end if RUBY_VERSION > '1.8.7'
- def memoize(reload = false, storage = nil)
+ def expirable_memoize(reload = false, storage = nil)
current_method = RUBY_VERSION >= '1.8.7' ? __called_from__ : __method__(1)
storage = "@#{storage || current_method}"
if reload
@@ -174,7 +174,7 @@ def memoized(method_name)
alias_method original_method, method_name
module_eval(<<-EVAL, __FILE__, __LINE__)
def #{method_name}(reload = false, *args, &block)
- memoize(reload) do
+ expirable_memoize(reload) do
send(:#{original_method}, *args, &block)
end
end
View
4 lib/aws/s3/object.rb
@@ -485,7 +485,7 @@ def value(options = {}, &block)
reload = options
options = {}
end
- memoize(reload) do
+ expirable_memoize(reload) do
self.class.stream(key, bucket.name, options, &block)
end
end
@@ -561,7 +561,7 @@ def rename(to, options = {})
def etag(reload = false)
return nil unless stored?
- memoize(reload) do
+ expirable_memoize(reload) do
reload ? about(reload)['etag'][1...-1] : attributes['e_tag'][1...-1]
end
end
View
2  lib/aws/s3/version.rb
@@ -4,7 +4,7 @@ module VERSION #:nodoc:
MAJOR = '0'
MINOR = '6'
TINY = '0'
- BETA = nil # Time.now.to_i.to_s
+ BETA = Time.now.to_i.to_s
end
Version = [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY, VERSION::BETA].compact * '.'
View
4 test/extensions_test.rb
@@ -144,13 +144,13 @@ def test___method___depth
class ModuleExtensionsTest < Test::Unit::TestCase
class Foo
def foo(reload = false)
- memoize(reload) do
+ expirable_memoize(reload) do
Time.now
end
end
def bar(reload = false)
- memoize(reload, :baz) do
+ expirable_memoize(reload, :baz) do
Time.now
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.