# Directory\_watcher 1.3.0

**URL:** <https://www.ruby-forum.com/t/directory-watcher-1-3-0/177668>\
**Category:** Ruby\
**Created:** [October 21, 2009, 7:13pm UTC](https://www.ruby-forum.com/t/directory-watcher-1-3-0/177668 "2009-10-21T19:13:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [October 21, 2009, 7:13pm UTC](https://www.ruby-forum.com/t/directory-watcher-1-3-0/177668/1 "2009-10-21T19:13:36Z")

</div>

directory\_watcher version 1.3.0  
by Tim P.  
[http://codeforpeople.rubyforge.org/directory\_watcher](http://codeforpeople.rubyforge.org/directory_watcher)

== DESCRIPTION

DirectoryWatcher is a class for watching files within a directory and  
generating events when those files change. This latest release adds  
support  
for Rev and EventMachine based file notifications. These libraries are  
more  
efficient than the default Ruby thread loop that polls the entire  
directory  
at a regular interval.

This example shows how to receive notifications for all ruby files in  
the  
current directory (and all its subdirectories) using the Rev library for  
notifications.

dw = DirectoryWatcher.new(‘.’, :glob =\> ‘\*\*/\*.rb’, :scanner =\> :rev)  
dw.add\_observer {|\*args| args.each {|event| puts event}}  
dw.start

The supported :scanner options are:

:em =\> EventMachine  
:rev =\> Rev  
nil =\> default Ruby thread loop

== CHANGES

- 2 major enhancements
  - added support for Rev based notifications
  - added support for EventMachine based notifications

== INSTALL

gem install directory\_watcher

You will need to install the “eventmachine” and / or “rev” gems if you  
wish to  
use either for file notifications.

== LINKS

GitHub: [GitHub - TwP/directory\_watcher: Event notification for file system changes](http://github.com/TwP/directory_watcher)  
Rubyforge: [http://codeforpeople.rubyforge.org/directory\_watcher](http://codeforpeople.rubyforge.org/directory_watcher)

Blessings,  
TwP
