Module: Listen
- Defined in:
- lib/listen/error.rb,
lib/listen.rb,
lib/listen/cli.rb,
lib/listen/fsm.rb,
lib/listen/file.rb,
lib/listen/change.rb,
lib/listen/logger.rb,
lib/listen/record.rb,
lib/listen/thread.rb,
lib/listen/adapter.rb,
lib/listen/backend.rb,
lib/listen/options.rb,
lib/listen/version.rb,
lib/listen/listener.rb,
lib/listen/silencer.rb,
lib/listen/directory.rb,
lib/listen/event/loop.rb,
lib/listen/adapter/bsd.rb,
lib/listen/event/queue.rb,
lib/listen/adapter/base.rb,
lib/listen/event/config.rb,
lib/listen/record/entry.rb,
lib/listen/adapter/linux.rb,
lib/listen/adapter/config.rb,
lib/listen/adapter/darwin.rb,
lib/listen/monotonic_time.rb,
lib/listen/adapter/polling.rb,
lib/listen/adapter/windows.rb,
lib/listen/event/processor.rb,
lib/listen/listener/config.rb,
lib/listen/queue_optimizer.rb,
lib/listen/silencer/controller.rb,
lib/listen/record/symlink_detector.rb
Overview
Listener implementation for BSD’s ‘kqueue`.
Defined Under Namespace
Modules: Adapter, Event, FSM, MonotonicTime, Thread Classes: Backend, CLI, Change, Directory, Error, File, Forwarder, Listener, Options, QueueOptimizer, Record, Silencer
Constant Summary collapse
- VERSION =
'3.9.0'
Class Attribute Summary collapse
-
.adapter_warn_behavior ⇒ Object
Returns the value of attribute adapter_warn_behavior.
- .logger ⇒ Object
Class Method Summary collapse
- .adapter_warn(message) ⇒ Object
-
.stop ⇒ Object
This is used by the ‘listen` binary to handle Ctrl-C.
-
.to(*args) {|modified, added, removed| ... } ⇒ Listen::Listener
Listens to file system modifications on a either single directory or multiple directories.
Class Attribute Details
.adapter_warn_behavior ⇒ Object
Returns the value of attribute adapter_warn_behavior.
13 14 15 |
# File 'lib/listen/logger.rb', line 13 def adapter_warn_behavior @adapter_warn_behavior end |
.logger ⇒ Object
15 16 17 |
# File 'lib/listen/logger.rb', line 15 def logger @logger ||= default_logger end |
Class Method Details
.adapter_warn(message) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/listen/logger.rb', line 19 def adapter_warn() case ENV['LISTEN_GEM_ADAPTER_WARN_BEHAVIOR']&.to_sym || adapter_warn_behavior_callback() when :log logger.warn() when :silent, nil, false # do nothing else # :warn warn() end end |
.stop ⇒ Object
This is used by the ‘listen` binary to handle Ctrl-C
37 38 39 40 41 42 43 44 45 |
# File 'lib/listen.rb', line 37 def stop while (listener = @listeners.deq(true)) begin listener.stop rescue WeakRef::RefError end end rescue ThreadError end |
.to(*args) {|modified, added, removed| ... } ⇒ Listen::Listener
Listens to file system modifications on a either single directory or multiple directories.
29 30 31 32 33 |
# File 'lib/listen.rb', line 29 def to(*args, &block) Listener.new(*args, &block).tap do |listener| @listeners.enq(WeakRef.new(listener)) end end |