Module: Grass::Cache
- Included in:
- Source
- Defined in:
- lib/grass/cache.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.clear_cache ⇒ Object
53 54 55 |
# File 'lib/grass/cache.rb', line 53 def clear_cache Grass.cache.delete self.class.generate_cachekey(self.key.fullpath,self.data) rescue nil end |
.included(base) ⇒ Object
24 25 26 27 |
# File 'lib/grass/cache.rb', line 24 def self.included(base) base.extend ClassMethods base.send :after_destroy, :clear_cache end |
Instance Method Details
#cache! ⇒ Object
36 37 38 |
# File 'lib/grass/cache.rb', line 36 def cache! set_cache end |
#commit!(result = nil) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/grass/cache.rb', line 29 def commit! result = nil # clear_cache if precompile? super(result) set_cache if precompile? self end |
#precompile? ⇒ Boolean
40 41 42 |
# File 'lib/grass/cache.rb', line 40 def precompile? self.binary.nil? && (self.type == "script" || self.type == "stylesheet") end |