Module Locale::Util
In: lib/locale/util/memoizable.rb

Methods

Classes and Modules

Module Locale::Util::Memoizable

External Aliases

freeze -> freeze_without_memoizable

Public Class methods

Public Instance methods

Cache the result of the methods.

 include Memoizable
 def foo
   ......
 end
 def bar(a, b)
   ......
 end
 memoize :foo, :bar(a, b)

To clear cache, clear_foo, clear_bar is also defined.

(NOTE)

  • Consider to use this with huge objects to avoid memory leaks.
  • Can‘t use this with super.<method> because of infinity loop.

Clear memoized values.

memoize with dup. A copy object is returned.

[Validate]