Method: FileMonitoring::FileStat#initialize

Defined in:
lib/file_monitoring/monitor_path.rb

#initialize(path, state = FileStatEnum::NEW, size = -1,, mod_time = -1,, indexed = false, cycles = 0) ⇒ FileStat

Initializes new file monitoring object

Arguments:

  • path - FileDir path

  • state - state. see class FileStatEnum. Default is NEW

  • size - File size [Byte]. Default is -1 (will be set later during monitor) todo:used?

  • mod_time - file mod time [seconds]. Default is -1 (will be set later during monitor)

  • indexed - Initialize file which is already indexed (used for dir rename case)

  • cycles - Initialize file which already passed monitor cycles (used for dir rename case)



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/file_monitoring/monitor_path.rb', line 65

def initialize(path, state=FileStatEnum::NEW, size=-1, mod_time=-1, indexed=false, cycles=0)
  # File\Dir path
  @path = path

  # File size
  @size = size

  # File modification time
  @modification_time = mod_time

  # File sate. see class FileStatEnum for states.
  @state = state

  # indicates if path EXISTS in file system.
  #   If true, file will not be removed during removed_unmarked_paths phase.
  @marked = false

  # Number of times that file was monitored and not changed.
  #  When @cycles exceeds ::FileMonitoring::stable_state, @state is set to Stable and can be indexed.
  @cycles = cycles

  # flag to indicate if file was indexed
  @indexed = indexed
end