class FileWatcher

Public Instance Methods

file_updated?() click to toggle source
# File lib/asset_watcher/filewatcher_ext.rb, line 2
def file_updated?
  @filenames.each do |filename|
    # Wait for the file's update.
    while not File.exist? filename
      puts "'#{filename}' is not found!"
      sleep 0.5 
    end 

    mtime = File.stat(filename).mtime
    updated = @last_mtimes[filename] < mtime
    @last_mtimes[filename] = mtime
    if(updated)
      @updated_file = filename
      return true
    end 
  end 
  return false
end