Class: FSWatcher::FoundFile

Inherits:
Object show all
Defined in:
lib/doozer/watcher.rb

Overview

A FoundFile entry for the FileSystemWatcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fileName, modTime, size, isNewFile = true, useMD5 = false) ⇒ FoundFile

Returns a new instance of FoundFile.



321
322
323
324
325
326
327
# File 'lib/doozer/watcher.rb', line 321

def initialize(fileName, modTime, size, isNewFile=true, useMD5=false)
  @fileName, @modTime, @size, @isNewFile  = fileName, modTime, size, isNewFile      
  @md5 = nil
  if useMD5 then
    genMD5()
  end
end

Instance Attribute Details

#fileNameObject (readonly)

Returns the value of attribute fileName.



319
320
321
# File 'lib/doozer/watcher.rb', line 319

def fileName
  @fileName
end

#md5Object (readonly)

Returns the value of attribute md5.



319
320
321
# File 'lib/doozer/watcher.rb', line 319

def md5
  @md5
end

#modTimeObject (readonly)

Returns the value of attribute modTime.



319
320
321
# File 'lib/doozer/watcher.rb', line 319

def modTime
  @modTime
end

#sizeObject (readonly)

Returns the value of attribute size.



319
320
321
# File 'lib/doozer/watcher.rb', line 319

def size
  @size
end

#statusObject (readonly)

Returns the value of attribute status.



319
320
321
# File 'lib/doozer/watcher.rb', line 319

def status
  @status
end

Instance Method Details

#genMD5Object

generate my files md5 value



347
348
349
# File 'lib/doozer/watcher.rb', line 347

def genMD5()
  @md5 = FSWatcher.genFileMD5(@fileName)
end

#isNew?Boolean

Returns:

  • (Boolean)


338
339
340
# File 'lib/doozer/watcher.rb', line 338

def isNew?
  return @isNewFile
end

#setMD5(newMD5) ⇒ Object



342
343
344
# File 'lib/doozer/watcher.rb', line 342

def setMD5(newMD5)
  @md5 = newMD5
end

#updateModTime(modTime) ⇒ Object



329
330
331
332
# File 'lib/doozer/watcher.rb', line 329

def updateModTime(modTime)
  @modTime = modTime
  @isNewFile = false
end

#updateSize(size) ⇒ Object



334
335
336
# File 'lib/doozer/watcher.rb', line 334

def updateSize(size)
  @size = size
end