Module: Erector::Caching::ClassMethods

Defined in:
lib/erector/caching.rb

Instance Method Summary collapse

Instance Method Details

#cachable?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
# File 'lib/erector/caching.rb', line 18

def cachable?
  if @cachable.nil?
    superclass.respond_to?(:cachable?) && superclass.cachable?
  else
    @cachable
  end
end

#cacheObject



36
37
38
# File 'lib/erector/caching.rb', line 36

def cache
  Erector::Cache.instance
end

#cache_optsObject



26
27
28
29
30
# File 'lib/erector/caching.rb', line 26

def cache_opts
  if cachable?
    @cache_opts || {}
  end
end

#cache_versionObject



32
33
34
# File 'lib/erector/caching.rb', line 32

def cache_version
  @cache_version || nil
end

#cacheable(value = true, opts = {}) ⇒ Object Also known as: cachable



8
9
10
11
12
13
14
# File 'lib/erector/caching.rb', line 8

def cacheable(value = true, opts = {})
  @cachable, @cache_opts = value, opts

  if value && value != true
    @cache_version = value
  end
end