Class: Omglog::Linux

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

Class Method Summary collapse

Class Method Details

.on_change(&block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/linux.rb', line 5

def self.on_change &block
  INotify::Notifier.new.tap do |notifier|
    notifier.watch('.git', :modify, :recursive, &block)
    ['TERM', 'INT', 'QUIT'].each do |signal|
      trap(signal) do
        notifier.stop
        exit(0)
      end
    end
    notifier.run
  end
end