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

### Methods

included memoize memoize_clear memoize_dup

### Constants

MEMOIZED_IVAR | = | Proc.new do |symbol| "#{symbol.to_s.sub(/\?\Z/, '_query').sub(/!\Z/, '_bang')}".to_sym end

### External Aliases

freeze | -> | freeze_without_memoizable

### Public Class methods

included(base)

### Public Instance methods

memoize(*symbols)

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. because of infinity loop.

memoize_clear()

Clear memoized values.

memoize_dup(*symbols)

memoize with dup. A copy object is returned.

[Validate]