Class | Listen::Adapter |
In: |
lib/listen/adapter.rb
|
Parent: | Object |
OPTIMIZED_ADAPTERS | = | %w[Darwin Linux BSD Windows] | The list of existing optimized adapters. | |
FALLBACK_ADAPTERS | = | %w[Polling] | The list of existing fallback adapters. | |
ADAPTERS | = | OPTIMIZED_ADAPTERS + FALLBACK_ADAPTERS | The list of all existing adapters. | |
DEFAULT_LATENCY | = | 0.25 | The default delay between checking for changes. | |
POLLING_FALLBACK_MESSAGE | = | <<-EOS.gsub(/^\s*/, '') Listen will be polling for changes. Learn more at https://github.com/guard/listen#polling-fallback. EOS .gsub(/^\s*/, '') | The default warning message when falling back to polling adapter. |
callback | [RW] | |
changed_directories | [RW] | |
directories | [RW] | |
latency | [RW] | |
mutex | [RW] | |
paused | [RW] | |
poller_thread | [RW] | |
stopped | [RW] | |
turnstile | [RW] | |
worker | [RW] | |
worker_thread | [RW] |
Initializes the adapter.
@param [String, Array<String>] directories the directories to watch @param [Hash] options the adapter options @option options [Float] latency the delay between checking for changes in seconds
@yield [changed_directories, options] callback Callback called when a change happens @yieldparam [Array<String>] changed_directories the changed directories @yieldparam [Hash] options callback options (like recursive: true)
@return [Listen::Adapter] the adapter
Selects the appropriate adapter implementation for the current OS and initializes it.
@param [String, Array<String>] directories the directories to watch @param [Hash] options the adapter options @option options [Boolean] force_polling to force polling or not @option options [String, Boolean] polling_fallback_message to change polling fallback message or remove it @option options [Float] latency the delay between checking for changes in seconds
@yield [changed_directories, options] callback the callback called when a change happens @yieldparam [Array<String>] changed_directories the changed directories @yieldparam [Hash] options callback options (like recursive: true)
@return [Listen::Adapter] the chosen adapter
Checks if the adapter is usable and works on the current OS.
@param [String, Array<String>] directories the directories to watch @param [Hash] options the adapter options @option options [Float] latency the delay between checking for changes in seconds
@return [Boolean] whether the adapter is usable and work or not
Runs a tests to determine if the adapter can actually pick up changes in a given directory and returns the result.
@note This test takes some time depending on the adapter latency.
@param [String, Pathname] directory the directory to watch @param [Hash] options the adapter options @option options [Float] latency the delay between checking for changes in seconds
@return [Boolean] whether the adapter works or not
Returns whether the adapter is paused or not.
@return [Boolean] whether the adapter is paused or not
Starts the adapter and don‘t block the current thread.
@param [Boolean] blocking whether or not to block the current thread after starting