Module: Cash::Config::ClassMethods
- Defined in:
- lib/cash/config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cache_config=(config) ⇒ Object
- #index(attributes, options = {}) ⇒ Object
- #inherited_with_cache_config(subclass) ⇒ Object
- #version(number) ⇒ Object
Class Method Details
.extended(a_class) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cash/config.rb', line 16 def self.extended(a_class) class << a_class def cache_config @cache_config ? @cache_config : superclass.cache_config end delegate :repository, :indices, :to => :cache_config alias_method_chain :inherited, :cache_config end end |
Instance Method Details
#cache_config=(config) ⇒ Object
41 42 43 |
# File 'lib/cash/config.rb', line 41 def cache_config=(config) @cache_config = config end |
#index(attributes, options = {}) ⇒ Object
32 33 34 35 |
# File 'lib/cash/config.rb', line 32 def index(attributes, = {}) .assert_valid_keys(:ttl, :order, :limit, :buffer, :order_column) (@cache_config.indices.unshift(Index.new(@cache_config, self, attributes, ))).uniq! end |
#inherited_with_cache_config(subclass) ⇒ Object
27 28 29 30 |
# File 'lib/cash/config.rb', line 27 def inherited_with_cache_config(subclass) inherited_without_cache_config(subclass) @cache_config.inherit(subclass) end |
#version(number) ⇒ Object
37 38 39 |
# File 'lib/cash/config.rb', line 37 def version(number) @cache_config.[:version] = number end |