Module: Listen
- Defined in:
- lib/listen/adapter/bsd.rb,
lib/listen.rb,
lib/listen/cli.rb,
lib/listen/file.rb,
lib/listen/change.rb,
lib/listen/record.rb,
lib/listen/adapter.rb,
lib/listen/version.rb,
lib/listen/listener.rb,
lib/listen/silencer.rb,
lib/listen/directory.rb,
lib/listen/adapter/tcp.rb,
lib/listen/tcp/message.rb,
lib/listen/adapter/base.rb,
lib/listen/adapter/linux.rb,
lib/listen/adapter/darwin.rb,
lib/listen/adapter/polling.rb,
lib/listen/adapter/windows.rb,
lib/listen/queue_optimizer.rb,
lib/listen/tcp/broadcaster.rb
Overview
Listener implementation for BSD's kqueue
.
Defined Under Namespace
Modules: Adapter, QueueOptimizer, TCP Classes: CLI, Change, Directory, File, Forwarder, Listener, Record, Silencer
Constant Summary collapse
- VERSION =
'2.7.6'
Class Attribute Summary collapse
-
.stopping ⇒ Object
Returns the value of attribute stopping.
Class Method Summary collapse
- .boot_celluloid ⇒ Object private
-
.on(target, *args) {|modified, added, removed| ... } ⇒ Listen::Listener
Listens to file system modifications broadcast over TCP.
-
.stop ⇒ Object
Stop all listeners & Celluloid.
-
.to(*args) {|modified, added, removed| ... } ⇒ Listen::Listener
Listens to file system modifications on a either single directory or multiple directories.
Class Attribute Details
.stopping ⇒ Object
Returns the value of attribute stopping.
6 7 8 |
# File 'lib/listen.rb', line 6 def stopping @stopping end |
Class Method Details
.boot_celluloid ⇒ Object (private)
60 61 62 |
# File 'lib/listen.rb', line 60 def boot_celluloid Celluloid.boot unless Celluloid.running? end |
.on(target, *args) {|modified, added, removed| ... } ⇒ Listen::Listener
Listens to file system modifications broadcast over TCP.
54 55 56 |
# File 'lib/listen.rb', line 54 def on(target, *args, &block) Listener.new(target, :recipient, *args, &block) end |
.stop ⇒ Object
Stop all listeners & Celluloid
Use it for testing purpose or when you are sure that Celluloid could be ended.
39 40 41 |
# File 'lib/listen.rb', line 39 def stop Celluloid.shutdown end |
.to(*args) {|modified, added, removed| ... } ⇒ Listen::Listener
Listens to file system modifications on a either single directory or multiple directories.
When :forward_to is specified, this listener will broadcast modifications over TCP.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/listen.rb', line 23 def to(*args, &block) boot_celluloid @stopping = false = args.last.is_a?(Hash) ? args.last : {} if target = .delete(:forward_to) Listener.new(target, :broadcaster, *args, &block) else Listener.new(*args, &block) end end |