Class: FSSM::Backends::Inotify
- Inherits:
-
Object
- Object
- FSSM::Backends::Inotify
- Defined in:
- lib/fssm/backends/inotify.rb
Instance Method Summary collapse
- #add_path(path, preload = true) ⇒ Object
-
#initialize ⇒ Inotify
constructor
A new instance of Inotify.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Inotify
Returns a new instance of Inotify.
3 4 5 |
# File 'lib/fssm/backends/inotify.rb', line 3 def initialize @notifier = INotify::Notifier.new end |
Instance Method Details
#add_path(path, preload = true) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/fssm/backends/inotify.rb', line 7 def add_path(path, preload=true) handler = FSSM::State.new(path) @notifier.watch(path.to_s, :all_events) do |event| handler.refresh(event.name) end handler.refresh(path.to_pathname, true) if preload end |
#run ⇒ Object
17 18 19 20 21 22 |
# File 'lib/fssm/backends/inotify.rb', line 17 def run begin @notifier.run rescue Interrupt end end |