Class: FseventsToVm::Watch

Inherits:
Object
  • Object
show all
Defined in:
lib/fsevents_to_vm/watch.rb

Instance Method Summary collapse

Constructor Details

#initialize(*listen_dirs) ⇒ Watch

Returns a new instance of Watch.


5
6
7
8
# File 'lib/fsevents_to_vm/watch.rb', line 5

def initialize(*listen_dirs)
  @listen_dirs = listen_dirs
  @fs = FSEvent.new
end

Instance Method Details

#runObject


10
11
12
13
14
15
16
17
18
# File 'lib/fsevents_to_vm/watch.rb', line 10

def run
  @fs.watch(@listen_dirs, file_events: true) do |files|
    files.each do |file|
      event = build_event(file)
      yield event if event
    end
  end
  @fs.run
end