Permalink
Browse files

Update the example with the new features of WDM

  • Loading branch information...
1 parent 692d8bb commit 5861ddf2895d607e2287fe98041345dd57d04723 @Maher4Ever committed Jul 22, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 example/changes_monitor.rb
View
12 example/changes_monitor.rb
@@ -1,13 +1,19 @@
require_relative '../lib/wdm'
monitor = WDM::Monitor.new
-monitor.watch('C:\Users\Maher\Desktop\test') { puts "change 1!" }
-monitor.watch('C:\Users\Maher\Desktop\psds') { puts "change 2!" }
+monitor.watch_recursively('C:\Users\Maher\Desktop\test') do |change|
+ puts "#{change.type.to_s.upcase}: '#{change.path}'"
+end
+
+puts "Running the monitor..."
thread = Thread.new {
monitor.run!
}
sleep(10)
-monitor.stop
+puts "Stopping the monitor..."
+
+monitor.stop
+thread.join

0 comments on commit 5861ddf

Please sign in to comment.