Module: Memoizable::ModuleMethods
- Defined in:
- lib/memoizable/module_methods.rb
Overview
Methods mixed in to memoizable singleton classes
Instance Method Summary collapse
-
#freezer ⇒ #call
private
Return default deep freezer.
-
#memoize(*methods) ⇒ self
Memoize a list of methods.
-
#memoized?(name) ⇒ Boolean
private
Test if an instance method is memoized.
-
#unmemoized_instance_method(name) ⇒ UnboundMethod
Return unmemoized instance method.
Instance Method Details
#freezer ⇒ #call
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return default deep freezer
13 14 15 |
# File 'lib/memoizable/module_methods.rb', line 13 def freezer Freezer end |
#memoize(*methods) ⇒ self
Memoize a list of methods
28 29 30 31 |
# File 'lib/memoizable/module_methods.rb', line 28 def memoize(*methods) methods.each(&method(:memoize_method)) self end |
#memoized?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test if an instance method is memoized
53 54 55 |
# File 'lib/memoizable/module_methods.rb', line 53 def memoized?(name) memoized_methods.key?(name) end |
#unmemoized_instance_method(name) ⇒ UnboundMethod
Return unmemoized instance method
80 81 82 |
# File 'lib/memoizable/module_methods.rb', line 80 def unmemoized_instance_method(name) memoized_methods[name].original_method end |