Top Level Namespace
Defined Under Namespace
Modules: Wires
Instance Method Summary collapse
Instance Method Details
#inotify_on(flags, channels = '*', &codeblock) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/wires/inotify.rb', line 8 def inotify_on(flags, channels='*', &codeblock) flags = [flags] unless flags.is_a? Array channels = [channels] unless channels.is_a? Array for channel in channels Wires::NotifyHub.watch(channel, *flags) events = flags.map!{|x| ("notify_"+x.to_s).to_sym} .map!{|x| x==:notify_all_events ? :notify : x } Wires::Channel.new(channel).register(events, codeblock) end nil end |