Skip to content

Instantly share code, notes, and snippets.

@rares
Created February 1, 2011 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rares/805124 to your computer and use it in GitHub Desktop.
Save rares/805124 to your computer and use it in GitHub Desktop.
require "cool.io"
class MyStatWatcher < Coolio::StatWatcher
def initialize(path, interval)
super
end
def on_change
puts path
end
end
path = ARGV[0] || "."
increment = ARGV[1] || 1
Cool.io::Loop.default.tap do |reactor|
MyStatWatcher.new(path, increment).tap do |watcher|
watcher.attach(reactor)
end
end.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment