Module: Cacheable

Extended by:
ModelFetch
Defined in:
lib/cacheable.rb,
lib/cacheable/keys.rb,
lib/cacheable/caches.rb,
lib/cacheable/expiry.rb,
lib/cacheable/version.rb,
lib/cacheable/model_fetch.rb,
lib/cacheable/types/key_cache.rb,
lib/cacheable/types/method_cache.rb,
lib/cacheable/types/attribute_cache.rb,
lib/cacheable/types/association_cache.rb,
lib/cacheable/types/class_method_cache.rb

Defined Under Namespace

Modules: AssocationCache, AttributeCache, Caches, ClassMethodCache, ClassMethods, Expiry, KeyCache, Keys, MethodCache, ModelFetch

Constant Summary collapse

VERSION =
"1.5.1"

Class Method Summary collapse

Methods included from ModelFetch

fetch

Class Method Details

.escape_punctuation(string) ⇒ Object



25
26
27
# File 'lib/cacheable.rb', line 25

def self.escape_punctuation(string)
  string.sub(/\?\Z/, '_query').sub(/!\Z/, '_bang')
end

.included(base) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cacheable.rb', line 10

def self.included(base)
  base.extend(Cacheable::Caches)
  base.send :include, Cacheable::Keys
  base.send :include, Cacheable::Expiry
  base.send :extend,  ClassMethods

  base.class_eval do
    class_attribute   :cached_key,
                      :cached_indices,
                      :cached_methods,
                      :cached_class_methods,
                      :cached_associations
  end
end

.rails4?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/cacheable.rb', line 29

def self.rails4?
  ActiveRecord::VERSION::MAJOR >= 4
end