Class: FileWatch::ReadMode::Processor

Inherits:
Processor
  • Object
show all
Defined in:
lib/filewatch/read_mode/processor.rb

Overview

Must handle

:read_file
:read_zip_file

Instance Attribute Summary

Attributes inherited from Processor

#watch

Instance Method Summary collapse

Methods inherited from Processor

#add_deletable_path, #add_watch, #clear_deletable_paths, #initialize, #restat

Constructor Details

This class inherits a constructor from FileWatch::Processor

Instance Method Details

#initialize_handlers(sincedb_collection, observer) ⇒ Object



13
14
15
16
17
18
# File 'lib/filewatch/read_mode/processor.rb', line 13

def initialize_handlers(sincedb_collection, observer)
  # we deviate from the tail mode handler initialization here
  # by adding a reference to self so we can read the quit flag during a (depth first) read loop
  @read_file = Handlers::ReadFile.new(self, sincedb_collection, observer, @settings)
  @read_zip_file = Handlers::ReadZipFile.new(self, sincedb_collection, observer, @settings)
end

#process_all_states(watched_files) ⇒ Object



28
29
30
31
32
# File 'lib/filewatch/read_mode/processor.rb', line 28

def process_all_states(watched_files)
  process_watched(watched_files)
  return if watch.quit?
  process_active(watched_files)
end

#read_file(watched_file) ⇒ Object



20
21
22
# File 'lib/filewatch/read_mode/processor.rb', line 20

def read_file(watched_file)
  @read_file.handle(watched_file)
end

#read_zip_file(watched_file) ⇒ Object



24
25
26
# File 'lib/filewatch/read_mode/processor.rb', line 24

def read_zip_file(watched_file)
  @read_zip_file.handle(watched_file)
end