class Core::Watch::Strategies::Digest

public

Identifies a path by digest or modified time (for directories).

Constants

BUFFER_LENGTH

Public Instance Methods

identify(path) click to toggle source
public
# File lib/core/watch/strategies/digest.rb, line 20
def identify(path)
  if path.file?
    md5 = OpenSSL::Digest.new("MD5")

    path.open("rb") do |file|
      buffer = +""
      while file.read(BUFFER_LENGTH, buffer)
        md5 << buffer
      end
    end

    md5.digest
  else
    path.mtime
  end
end