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
16 17 18 19 |
# File 'lib/memoizable/instance_methods.rb', line 16 def freeze memoized_method_cache # initialize method cache super end |
#memoize(data) ⇒ self
Sets a memoized value for a method
32 33 34 35 |
# File 'lib/memoizable/instance_methods.rb', line 32 def memoize(data) data.each { |name, value| memoized_method_cache[name] = value } self end |