Class: Lotus::Assets::Cache Private
- Inherits:
-
Object
- Object
- Lotus::Assets::Cache
- Defined in:
- lib/lotus/assets/cache.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Store assets references when compile mode is on.
This is expecially useful in development mode, where we want to compile only the assets that were changed from last browser refresh.
Instance Method Summary collapse
-
#fresh?(file) ⇒ TrueClass, FalseClass
private
Check if the given file is fresh or changed from last check.
-
#initialize ⇒ Lotus::Assets::Cache
constructor
private
Return a new instance.
-
#store(file) ⇒ TrueClass, FalseClass
private
Store the given file reference.
Constructor Details
#initialize ⇒ Lotus::Assets::Cache
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a new instance
16 17 18 19 |
# File 'lib/lotus/assets/cache.rb', line 16 def initialize @data = Hash.new{|h,k| h[k] = 0 } @mutex = Mutex.new end |
Instance Method Details
#fresh?(file) ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if the given file is fresh or changed from last check.
29 30 31 32 33 |
# File 'lib/lotus/assets/cache.rb', line 29 def fresh?(file) @mutex.synchronize do @data[file.to_s] < mtime(file) end end |
#store(file) ⇒ TrueClass, FalseClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Store the given file reference
43 44 45 46 47 |
# File 'lib/lotus/assets/cache.rb', line 43 def store(file) @mutex.synchronize do @data[file.to_s] = mtime(file) end end |