Methods mixed in to memoizable singleton classes
Return default deep freezer
@return [call]
@api private
# File lib/memoizable/module_methods.rb, line 12 def freezer Freezer end
Memoize a list of methods
@example
memoize :hash
@param [Array<Symbol>] methods
a list of methods to memoize
@return [self]
@api public
# File lib/memoizable/module_methods.rb, line 27 def memoize(*methods) methods.each(&method(:memoize_method)) self end
Test if an instance method is memoized
@example
class Foo include Memoizable def bar end memoize :bar end Foo.memoized?(:bar) # true Foo.memoized?(:baz) # false
@param [Symbol] name
@return [Boolean]
true if method is memoized, false if not
@api private
# File lib/memoizable/module_methods.rb, line 52 def memoized?(name) memoized_methods.key?(name) end
Return unmemoized instance method
@example
class Foo include Memoizable def bar end memoize :bar end Foo.unmemoized_instance_method(:bar)
@param [Symbol] name
@return [UnboundMethod]
the memoized method
@raise [NameError]
raised if the method is unknown
@api public
# File lib/memoizable/module_methods.rb, line 79 def unmemoized_instance_method(name) memoized_methods[name].original_method end
Generated with the Darkfish Rdoc Generator 2.