Guard::Linux

Listener implementation for Linux `inotify`.

Public Class Methods

new(*) click to toggle source

Initialize the Listener.

# File lib/guard/listeners/linux.rb, line 9
def initialize(*)
  super
  @inotify = INotify::Notifier.new
  @files   = []
  @latency = 0.5
end
usable?(no_vendor = false) click to toggle source

Check if the listener is usable on the current OS.

@return [Boolean] whether usable or not

# File lib/guard/listeners/linux.rb, line 35
def self.usable?(no_vendor = false)
  return false unless RbConfig::CONFIG['target_os'] =~ /linux/

  $LOAD_PATH << File.expand_path('../../../vendor/linux/lib', __FILE__) unless no_vendor
  require 'rb-inotify'
  true
rescue LoadError
  false
end

Public Instance Methods

start() click to toggle source

Start the listener.

# File lib/guard/listeners/linux.rb, line 18
def start
  @stop = false
  super
  watch_change unless watch_change?
end
stop() click to toggle source

Stop the listener.

# File lib/guard/listeners/linux.rb, line 26
def stop
  super
  @stop = true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.