Sha256: 2f607b0b348fd45e0d9ac726030badc385aac72240f268047ba1f7a84d6241aa
Contents?: true
Size: 807 Bytes
Versions: 13
Compression:
Stored size: 807 Bytes
Contents
module Libuv class FSEvent < Handle define_callback function: :on_fs_event, params: [:pointer, :string, :int, :int] EVENTS = {1 => :rename, 2 => :change}.freeze def initialize(thread, path) @loop = thread fs_event_ptr = ::Libuv::Ext.allocate_handle_fs_event error = check_result ::Libuv::Ext.fs_event_init(thread.handle, fs_event_ptr, path, callback(:on_fs_event, fs_event_ptr.address), 0) super(fs_event_ptr, error) end private def on_fs_event(handle, filename, events, status) e = check_result(status) if e reject(e) else defer.notify(filename, EVENTS[events]) # notify of a change end end end end
Version data entries
13 entries across 13 versions & 1 rubygems