Class: AutoCommit::Detector

Inherits:
Object
  • Object
show all
Defined in:
lib/autocommit/detector.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir, &block) ⇒ Detector

Returns a new instance of Detector.



5
6
7
8
9
10
11
# File 'lib/autocommit/detector.rb', line 5

def initialize dir, &block
  @notifier = INotify::Notifier.new
  @notifier.watch dir, :create, :modify, :delete, :moved_to, :moved_from, :recursive, &block
  @t = Thread.new {
    @notifier.run
  }
end

Instance Method Details

#stopObject



13
14
15
16
# File 'lib/autocommit/detector.rb', line 13

def stop
  @t.kill
  @t.join
end