Module: Cacheable
- Extended by:
- CacheAdapter
- Defined in:
- lib/cacheable.rb,
lib/cacheable/version.rb,
lib/cacheable/cache_adapter.rb,
lib/cacheable/cache_adapters.rb,
lib/cacheable/method_generator.rb,
lib/cacheable/cache_adapters/memory_adapter.rb
Defined Under Namespace
Modules: CacheAdapter, CacheAdapters, MethodGenerator, VERSION
Constant Summary collapse
- MEMOIZE_NOT_SET =
Sentinel value to distinguish “not yet memoized” from a memoized nil/false.
Object.new.freeze
Constants included from CacheAdapter
CacheAdapter::CACHE_ADAPTER_METHODS, CacheAdapter::DEFAULT_ADAPTER
Class Method Summary collapse
Methods included from CacheAdapter
cache_adapter, cache_adapter=, extended
Class Method Details
.included(base) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cacheable.rb', line 37 def self.included(base) base.extend(Cacheable::CacheAdapter) base.extend(Cacheable::MethodGenerator) interceptor_name = base.send(:method_interceptor_module_name) interceptor = Module.new interceptor.define_singleton_method(:to_s) { interceptor_name } interceptor.define_singleton_method(:inspect) { interceptor_name } base.instance_variable_set(:@_cacheable_interceptor, interceptor) base.prepend interceptor end |