Sha256: bf8a7385cc451338a7d28585e1ecaa418d71e8b23b5a7a30cd93ce5c0a6ee888
Contents?: true
Size: 326 Bytes
Versions: 2
Compression:
Stored size: 326 Bytes
Contents
module Memoizable def memoize( name, cache = Hash.new ) original = "__unmemoized_#{name}__" ([Class, Module].include?(self.class) ? self : self.class).class_eval do alias_method original, name private original define_method(name) { |*args| cache[args] ||= send(original, *args) } end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
amazon-mws-plus-0.1.3 | lib/amazon/mws/lib/memoizable.rb |
amazon-mws-0.1.0 | lib/amazon/mws/lib/memoizable.rb |