Class: FileWatch::Discoverer
- Inherits:
-
Object
- Object
- FileWatch::Discoverer
- Includes:
- LogStash::Util::Loggable
- Defined in:
- lib/filewatch/discoverer.rb
Instance Method Summary collapse
- #add_path(path) ⇒ Object
- #discover ⇒ Object
-
#initialize(watched_files_collection, sincedb_collection, settings) ⇒ Discoverer
constructor
A new instance of Discoverer.
Constructor Details
#initialize(watched_files_collection, sincedb_collection, settings) ⇒ Discoverer
Returns a new instance of Discoverer.
12 13 14 15 16 17 18 19 |
# File 'lib/filewatch/discoverer.rb', line 12 def initialize(watched_files_collection, sincedb_collection, settings) @watching = [] @exclude = [] @watched_files_collection = watched_files_collection @sincedb_collection = sincedb_collection @settings = settings @settings.exclude.each { |p| @exclude << p } end |
Instance Method Details
#add_path(path) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/filewatch/discoverer.rb', line 21 def add_path(path) return if @watching.member?(path) @watching << path discover_files(path) self end |
#discover ⇒ Object
28 29 30 31 32 |
# File 'lib/filewatch/discoverer.rb', line 28 def discover @watching.each do |path| discover_files(path) end end |