class Alki::Reload::ListenWatcher::Listener

Public Class Methods

new(dirs,reloader) click to toggle source
# File lib/alki/reload/listen_watcher.rb, line 33
def initialize(dirs,reloader)
  @count = 0
  @listen = Listen.to(*dirs) do |modified, added, removed|
    if @count > 0 && (modified || added || removed)
      reloader.reload
    end
  end
end

Public Instance Methods

start() click to toggle source
# File lib/alki/reload/listen_watcher.rb, line 42
def start
  if @count == 0
    @listen.start
  end
  @count += 1
end
stop() click to toggle source
# File lib/alki/reload/listen_watcher.rb, line 49
def stop
  @count -= 1
end