Module: Erector::Caching
- Included in:
- Widget
- Defined in:
- lib/erector/caching.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 |
# File 'lib/erector/caching.rb', line 3 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#cache_name ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/erector/caching.rb', line 31 def cache_name [].tap do |a| self.class.cacheable_opts[:static_keys].each do |x| if x.is_a?(Symbol) && respond_to?(x) a << send(x) else a << x end end self.class.cacheable_opts[:dynamic_keys].each do |x| a << instance_variable_get(:"@#{x}") end end.reject(&:nil?) end |
#cache_options ⇒ Object
47 48 49 50 51 |
# File 'lib/erector/caching.rb', line 47 def { skip_digest: self.class.cacheable_opts[:skip_digest] } end |
#cacheable? ⇒ Boolean
27 28 29 |
# File 'lib/erector/caching.rb', line 27 def cacheable? !self.class.cacheable_opts.nil? end |