Module: VimMate::Plugin::INotifyDirectory::ClassMethods
- Defined in:
- lib/vim_mate/plugins/inotify/lib/directory.rb
Instance Method Summary collapse
Instance Method Details
#ignore_file_changes?(filename) ⇒ Boolean
52 53 54 |
# File 'lib/vim_mate/plugins/inotify/lib/directory.rb', line 52 def ignore_file_changes?(filename) Exclusions.any? { |exclusion| filename =~ exclusion } end |
#inotify_watcher ⇒ Object
33 34 35 |
# File 'lib/vim_mate/plugins/inotify/lib/directory.rb', line 33 def inotify_watcher @@inotify_watcher ||= INotify::INotify.new end |
#start_inotify_watcher ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vim_mate/plugins/inotify/lib/directory.rb', line 37 def start_inotify_watcher inotify_watcher.start do |event| next if ignore_file_changes? event.filename path = File.join(event.path, event.filename) case event.type when 'modify' ActiveWindow::Signal.emit_file_modified(path) when /^delete|moved_from$/ ActiveWindow::Signal.emit_file_deleted(path) when /^create|moved_to$/ ActiveWindow::Signal.emit_file_created(path) end end end |