Module: Erector::Caching::ClassMethods
- Defined in:
- lib/erector/caching.rb
Instance Method Summary collapse
- #cachable? ⇒ Boolean
- #cache ⇒ Object
- #cache_opts ⇒ Object
- #cache_version ⇒ Object
- #cacheable(value = true, opts = {}) ⇒ Object (also: #cachable)
Instance Method Details
#cachable? ⇒ 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 |
#cache ⇒ Object
36 37 38 |
# File 'lib/erector/caching.rb', line 36 def cache Erector::Cache.instance end |
#cache_opts ⇒ Object
26 27 28 29 30 |
# File 'lib/erector/caching.rb', line 26 def cache_opts if cachable? @cache_opts || {} end end |
#cache_version ⇒ Object
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 |