Class: Sprockets::Webpack::FileGuard
- Inherits:
-
Object
- Object
- Sprockets::Webpack::FileGuard
- Defined in:
- lib/sprockets/webpack/file_guard.rb
Instance Method Summary collapse
- #detect_change? ⇒ Boolean
-
#initialize(path) ⇒ FileGuard
constructor
A new instance of FileGuard.
Constructor Details
#initialize(path) ⇒ FileGuard
Returns a new instance of FileGuard.
4 5 6 7 |
# File 'lib/sprockets/webpack/file_guard.rb', line 4 def initialize(path) @path = Pathname.new(path) @last_mtime = @path.mtime end |
Instance Method Details
#detect_change? ⇒ Boolean
9 10 11 12 13 14 |
# File 'lib/sprockets/webpack/file_guard.rb', line 9 def detect_change? current_mtime = @path.mtime @last_mtime < current_mtime ensure @last_mtime = current_mtime end |