Class: Hanami::Assets::Cache::File Private
- Inherits:
-
Object
- Object
- Hanami::Assets::Cache::File
- Defined in:
- lib/hanami/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.
File cache entry
Instance Method Summary collapse
-
#initialize(file, mtime: nil, dependencies: nil) ⇒ File
constructor
private
A new instance of File.
- #modified?(other) ⇒ Boolean private
Constructor Details
#initialize(file, mtime: nil, dependencies: nil) ⇒ File
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.
Returns a new instance of File.
21 22 23 24 25 26 |
# File 'lib/hanami/assets/cache.rb', line 21 def initialize(file, mtime: nil, dependencies: nil) @file = file.is_a?(String) ? Pathname.new(file) : file @mtime = mtime || @file.mtime.utc.to_i @dependencies = (dependencies || []).map { |d| self.class.new(d) } end |
Instance Method Details
#modified?(other) ⇒ Boolean
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.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/hanami/assets/cache.rb', line 30 def modified?(other) file = other.is_a?(self.class) ? other : self.class.new(other) if dependencies? modified_dependencies?(file) || mtime <= file.mtime else mtime < file.mtime end end |