Class: FSWatcher::FoundFile
- Inherits:
-
Object
- Object
- FSWatcher::FoundFile
- Defined in:
- lib/filesystemwatcher/filesystemwatcher.rb
Overview
A FoundFile entry for the FileSystemWatcher
Instance Attribute Summary collapse
-
#fileName ⇒ Object
readonly
Returns the value of attribute fileName.
-
#md5 ⇒ Object
readonly
Returns the value of attribute md5.
-
#modTime ⇒ Object
readonly
Returns the value of attribute modTime.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#genMD5 ⇒ Object
generate my files md5 value.
-
#initialize(fileName, modTime, size, isNewFile = true, useMD5 = false) ⇒ FoundFile
constructor
A new instance of FoundFile.
- #isNew? ⇒ Boolean
- #setMD5(newMD5) ⇒ Object
- #updateModTime(modTime) ⇒ Object
- #updateSize(size) ⇒ Object
Constructor Details
#initialize(fileName, modTime, size, isNewFile = true, useMD5 = false) ⇒ FoundFile
Returns a new instance of FoundFile.
256 257 258 259 260 261 262 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 256 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
#fileName ⇒ Object (readonly)
Returns the value of attribute fileName.
254 255 256 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 254 def fileName @fileName end |
#md5 ⇒ Object (readonly)
Returns the value of attribute md5.
254 255 256 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 254 def md5 @md5 end |
#modTime ⇒ Object (readonly)
Returns the value of attribute modTime.
254 255 256 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 254 def modTime @modTime end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
254 255 256 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 254 def size @size end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
254 255 256 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 254 def status @status end |
Instance Method Details
#genMD5 ⇒ Object
generate my files md5 value
282 283 284 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 282 def genMD5() @md5 = FSWatcher.genFileMD5(@fileName) end |
#isNew? ⇒ Boolean
273 274 275 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 273 def isNew? return @isNewFile end |
#setMD5(newMD5) ⇒ Object
277 278 279 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 277 def setMD5(newMD5) @md5 = newMD5 end |
#updateModTime(modTime) ⇒ Object
264 265 266 267 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 264 def updateModTime(modTime) @modTime = modTime @isNewFile = false end |
#updateSize(size) ⇒ Object
269 270 271 |
# File 'lib/filesystemwatcher/filesystemwatcher.rb', line 269 def updateSize(size) @size = size end |