Class: Sprockets::Webpack::FileGuard

Inherits:
Object
  • Object
show all
Defined in:
lib/sprockets/webpack/file_guard.rb

Instance Method Summary collapse

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

Returns:



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