Skip to content

Instantly share code, notes, and snippets.

@ymendel
Created August 9, 2008 21:49
Show Gist options
  • Save ymendel/4707 to your computer and use it in GitHub Desktop.
Save ymendel/4707 to your computer and use it in GitHub Desktop.
Cassady:~ yossef$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'fsevents'
=> true
irb(main):003:0> stream = FSEvents::Stream.watch(File.expand_path('~/tmp')) do |events|
irb(main):004:1* p events
irb(main):005:1> end
=> #<FSEvents::Stream:0x1d8ad3c @dirs={}, @stream=#<OSX::ConstFSEventStreamRef:0x1d8ab34>, @paths=["/Users/yossef/tmp"], @mode=:mtime, @flags=0, @context=nil, @callback=#<Proc:0x01d8ae90@(irb):3>, @last_event=Sat Aug 09 16:47:55 -0500 2008, @latency=1.0, @allocator=nil, @since=-1>
irb(main):006:0> stream.run
(in other window)
Cassady:~/tmp yossef$ cp ~/Music/test2.flac .
(in this window)
[#<FSEvents::Event:0x1d86ca0 @stream=#<FSEvents::Stream:0x1d8ad3c @dirs={}, @stream=#<OSX::ConstFSEventStreamRef:0x1d8ab34>, @paths=["/Users/yossef/tmp"], @mode=:mtime, @flags=0, @context=nil, @callback=#<Proc:0x01d8ae90@(irb):3>, @last_event=Sat Aug 09 16:52:24 -0500 2008, @latency=1.0, @allocator=nil, @since=-1>, @path="/Users/yossef/tmp", @id=1632706003>]
[#<FSEvents::Event:0x1d86840 @stream=#<FSEvents::Stream:0x1d8ad3c @dirs={}, @stream=#<OSX::ConstFSEventStreamRef:0x1d8ab34>, @paths=["/Users/yossef/tmp"], @mode=:mtime, @flags=0, @context=nil, @callback=#<Proc:0x01d8ae90@(irb):3>, @last_event=Sat Aug 09 16:52:49 -0500 2008, @latency=1.0, @allocator=nil, @since=-1>, @path="/Users/yossef/tmp", @id=1632706355>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment