Class: AutoCommit::Detector
- Inherits:
-
Object
- Object
- AutoCommit::Detector
- Defined in:
- lib/autocommit/detector.rb
Instance Method Summary collapse
-
#initialize(dir, &block) ⇒ Detector
constructor
A new instance of Detector.
- #stop ⇒ Object
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
#stop ⇒ Object
13 14 15 16 |
# File 'lib/autocommit/detector.rb', line 13 def stop @t.kill @t.join end |