Module: Memoizable::InstanceMethods
- Included in:
- Memoizable
- Defined in:
- lib/memoizable/instance_methods.rb
Overview
Methods mixed in to memoizable instances
Instance Method Summary collapse
-
#freeze ⇒ Object
Freeze the object.
-
#memoize(data) ⇒ self
Sets a memoized value for a method.
Instance Method Details
#freeze ⇒ Object
Freeze the object
14 15 16 17 |
# File 'lib/memoizable/instance_methods.rb', line 14 def freeze memoized_method_cache # initialize method cache super end |
#memoize(data) ⇒ self
Sets a memoized value for a method
30 31 32 33 |
# File 'lib/memoizable/instance_methods.rb', line 30 def memoize(data) data.each { |name, value| memoized_method_cache.store([self.class, name], value) } self end |