Permalink
Browse files

Fix example due to changed EMDirWatcher.watch API

  • Loading branch information...
1 parent 318ac21 commit a2c445b5d05da0d02e91267891e6d80748547060 @dottedmag dottedmag committed Aug 8, 2010
Showing with 13 additions and 10 deletions.
  1. +13 −10 examples/monitor.rb
View
@@ -9,18 +9,21 @@
exclusions = ARGV.select { |arg| arg =~ /^!/ }.collect { |arg| arg[1..-1] }
EM.error_handler{ |e|
- puts "Error raised during event loop: #{e.class.name} #{e.message}"
- puts e.backtrace
+ puts "Error raised during event loop: #{e.class.name} #{e.message}"
+ puts e.backtrace
}
EM.run {
- dw = EMDirWatcher.watch dir, :include_only => inclusions, :exclude => exclusions do |path|
- full_path = File.join(dir, path)
- if File.exists? full_path
- puts "Modified: #{path}"
- else
- puts "Deleted: #{path}"
- end
+ dw = EMDirWatcher.watch dir, :include_only => inclusions, :exclude => exclusions do |paths|
+ paths.each do |path|
+ puts path
+ full_path = File.join(dir, path)
+ if File.exists? full_path
+ puts "Modified: #{path}"
+ else
+ puts "Deleted: #{path}"
+ end
end
- puts "Monitoring #{File.expand_path(dir)}..."
+ end
+ puts "Monitoring #{File.expand_path(dir)}..."
}

0 comments on commit a2c445b

Please sign in to comment.