Module: Rodbot::Memoize
- Included in:
- Db::Redis, Plugins::Matrix::Relay, Plugins::Otp::App::RequestMethods, Plugins::Slack::Relay, Refinements, Relay, Services::App, Services::App, Services::Relay
- Defined in:
- lib/rodbot/memoize.rb
Overview
Memoize the return value of a specific method
The method signature is taken into account, therefore calls of the same method with different positional and/or keyword arguments are cached independently. On the other hand, when calling the method with a block, no memoization is performed at all.
Defined Under Namespace
Modules: ClassMethods
Class Attribute Summary collapse
-
.cache ⇒ Object
readonly
Returns the value of attribute cache.
Class Method Summary collapse
Class Attribute Details
.cache ⇒ Object (readonly)
Returns the value of attribute cache.
70 71 72 |
# File 'lib/rodbot/memoize.rb', line 70 def cache @cache end |
Class Method Details
.included(base) ⇒ Object
72 73 74 75 |
# File 'lib/rodbot/memoize.rb', line 72 def included(base) base.extend(ClassMethods) @cache ||= {} end |