Class: Build::Files::Monitor::INotify
- Defined in:
- lib/build/files/monitor/inotify.rb
Instance Attribute Summary
Attributes inherited from Polling
Instance Method Summary collapse
Methods inherited from Polling
#add, #delete, #initialize, #roots, #track_changes, #update
Constructor Details
This class inherits a constructor from Build::Files::Monitor::Polling
Instance Method Details
#run(**options, &block) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/build/files/monitor/inotify.rb', line 29 def run(**, &block) notifier = ::INotify::Notifier.new catch(:interrupt) do while true self.roots.each do |root| notifier.watch root, :create, :modify, :attrib, :delete do |event| self.update([root]) yield if self.updated notifier.stop end end end notifier.run end end end |