Class: Listen::Adapter::BSD

Inherits:
Base
  • Object
show all
Defined in:
lib/listen/adapter/bsd.rb

Overview

Listener implementation for BSD’s kqueue.

Constant Summary collapse

EVENTS =

Watched kqueue events

[:delete, :write, :extend, :attrib, :rename]
BUNDLER_DECLARE_GEM =

The message to show when wdm gem isn’t available

"  Please add the following to your Gemfile to avoid polling for changes:\n    require 'rbconfig'\n    gem 'rb-kqueue', '>= 0.2' if RbConfig::CONFIG['target_os'] =~ /freebsd/i\n".gsub(/^ {6}/, '')

Constants inherited from Base

Listen::Adapter::Base::DEFAULT_LATENCY

Instance Attribute Summary

Attributes inherited from Base

#listener

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Listen::Adapter::Base

Class Method Details

.usable?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
30
# File 'lib/listen/adapter/bsd.rb', line 22

def self.usable?
  if RbConfig::CONFIG['target_os'] =~ /freebsd/i
    require 'rb-kqueue'
    require 'find'
    true
  end
rescue Gem::LoadError
  Kernel.warn BUNDLER_DECLARE_GEM
end

Instance Method Details

#startObject



32
33
34
35
# File 'lib/listen/adapter/bsd.rb', line 32

def start
  worker = _init_worker
  worker.poll
end