Module: Sparkle::Refreshable

Defined in:
lib/sparkle/refreshable.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/sparkle/refreshable.rb', line 4

def self.included(base)
  base.extend ClassMethods
  base.class_eval do
    class_inheritable_accessor :_sparkle_cache_refresh_method
    attr_accessor :_sparkle_cached_
    attr_accessor :_sparkle_cache_key_
  end
end

Instance Method Details

#_sparkle_refresh!Object



13
14
15
16
# File 'lib/sparkle/refreshable.rb', line 13

def _sparkle_refresh!
  self.send self.class._sparkle_cache_refresh_method
  Rails.cache.write(self._sparkle_cache_key_, self)
end