Class: Listen::Adapters::Linux
- Inherits:
-
Listen::Adapter
- Object
- Listen::Adapter
- Listen::Adapters::Linux
- Defined in:
- lib/listen/adapters/linux.rb
Overview
Listener implementation for Linux ‘inotify`.
Constant Summary
Constants inherited from Listen::Adapter
Listen::Adapter::DEFAULT_LATENCY, Listen::Adapter::POLLING_FALLBACK_MESSAGE
Instance Attribute Summary
Attributes inherited from Listen::Adapter
Class Method Summary collapse
-
.usable? ⇒ Boolean
Check if the adapter is usable on the current OS.
Instance Method Summary collapse
-
#initialize(directory, options = {}, &callback) ⇒ Linux
constructor
Initialize the Adapter.
-
#start ⇒ Object
Start the adapter.
-
#stop ⇒ Object
Stop the adapter.
Methods inherited from Listen::Adapter
Constructor Details
#initialize(directory, options = {}, &callback) ⇒ Linux
Initialize the Adapter. See Listen::Adapter#initialize for more info.
19 20 21 22 23 |
# File 'lib/listen/adapters/linux.rb', line 19 def initialize(directory, = {}, &callback) super @changed_dirs = Set.new init_worker end |
Class Method Details
.usable? ⇒ Boolean
Check if the adapter is usable on the current OS.
44 45 46 47 48 49 50 51 |
# File 'lib/listen/adapters/linux.rb', line 44 def self.usable? return false unless RbConfig::CONFIG['target_os'] =~ /linux/i require 'rb-inotify' true rescue LoadError false end |
Instance Method Details
#start ⇒ Object
Start the adapter.
27 28 29 30 31 |
# File 'lib/listen/adapters/linux.rb', line 27 def start super Thread.new { @worker.run } poll_changed_dirs end |
#stop ⇒ Object
Stop the adapter.
35 36 37 38 |
# File 'lib/listen/adapters/linux.rb', line 35 def stop super @worker.stop end |