Class: AridCache::Store::Configuration
- Inherits:
-
Struct
- Object
- Struct
- AridCache::Store::Configuration
- Defined in:
- lib/arid_cache/store.rb
Overview
Capture cache configurations and blocks and store them in the store.
A block is evaluated within the scope of this class. The blocks contains calls to methods which define the caches and give options for each cache.
Don’t instantiate directly. Rather instantiate the Instance- or ClassCacheConfiguration.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#global_opts ⇒ Object
Returns the value of attribute global_opts.
-
#klass ⇒ Object
Returns the value of attribute klass.
Instance Method Summary collapse
-
#initialize(klass, global_opts = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #method_missing(key, *args, &block) ⇒ Object
Constructor Details
#initialize(klass, global_opts = {}) ⇒ Configuration
Returns a new instance of Configuration.
53 54 55 56 |
# File 'lib/arid_cache/store.rb', line 53 def initialize(klass, global_opts={}) self.global_opts = global_opts self.klass = klass end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, *args, &block) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/arid_cache/store.rb', line 58 def method_missing(key, *args, &block) opts = global_opts.merge(args.empty? ? {} : args.first) case self when InstanceCacheConfiguration AridCache.store.add_instance_cache_configuration(klass, key, opts, block) else AridCache.store.add_class_cache_configuration(klass, key, opts, block) end end |
Instance Attribute Details
#global_opts ⇒ Object
Returns the value of attribute global_opts
51 52 53 |
# File 'lib/arid_cache/store.rb', line 51 def global_opts @global_opts end |
#klass ⇒ Object
Returns the value of attribute klass
51 52 53 |
# File 'lib/arid_cache/store.rb', line 51 def klass @klass end |