rb-inotify 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb4c62648ba29b5ec98d68e15997cf32f6e6f92e27d4821f49de4173a78efc0a
4
- data.tar.gz: 5f2b3f9c2d48383f56cfcfbc64e20c868958267cbddf503c3abdfc9ffd79e273
3
+ metadata.gz: f0606a3b14ba7783689483410651837223b0a9d2967572cd768c421db22462bb
4
+ data.tar.gz: 28425a8d1c6c7067f365499185ef9916c0c9892fa467f74f5adbfc18039e4b19
5
5
  SHA512:
6
- metadata.gz: '0682826d3fb06dc0d6fae0fcbd815cafd0d765692c0765b70ec7747514e8769b25a940d1bcce9c154fcd9b64336622c0cfb49485ab3ef1e4041d2872b2949e95'
7
- data.tar.gz: 9d9d61b740e92704547a130297ca436e219fea53509a212475fff77df20d214a6e630eccd0d166badb19003745b7f08e7fd3187710f80bebfeba0278bb8137d4
6
+ metadata.gz: f8b727242e12cb3debd140ac9b3e45a114f77c0642f33faa252f258360113ccf1fa16fb4c08ed1c16772884aef22d913ce394d3a4bf2be8a0754865a09e39f13
7
+ data.tar.gz: '02940752a3b3c8b44a465b71300290d60b910def4a56dfac8949a8f69379b8b58b01d278e58cb99c138eb8a6187fb8f44307efae15c9a3bf7c265991f90aebb4'
@@ -24,10 +24,8 @@ module INotify
24
24
  # # Nothing happens until you run the notifier!
25
25
  # notifier.run
26
26
  class Notifier
27
- # A list of directories that should never be recursively watched.
28
- #
29
27
  # * Files in `/dev/fd` sometimes register as directories, but are not enumerable.
30
- RECURSIVE_BLACKLIST = %w[/dev/fd]
28
+ NON_RECURSIVE = "/dev/fd"
31
29
 
32
30
  # A hash from {Watcher} ids to the instances themselves.
33
31
  #
@@ -198,20 +196,17 @@ module INotify
198
196
  def watch(path, *flags, &callback)
199
197
  return Watcher.new(self, path, *flags, &callback) unless flags.include?(:recursive)
200
198
 
201
- dir = Dir.new(path)
199
+ dont_follow = flags.include?(:dont_follow)
202
200
 
203
- dir.each do |base|
201
+ Dir.each_child(path) do |base|
204
202
  d = File.join(path, base)
205
- binary_d = d.respond_to?(:force_encoding) ? d.dup.force_encoding('BINARY') : d
206
- next if binary_d =~ /\/\.\.?$/ # Current or parent directory
207
- next if RECURSIVE_BLACKLIST.include?(d)
208
- next if flags.include?(:dont_follow) && File.symlink?(d)
209
- next if !File.directory?(d)
203
+ next unless File.directory?(d)
204
+ next if dont_follow && File.symlink?(d)
205
+ next if NON_RECURSIVE == d
210
206
 
211
207
  watch(d, *flags, &callback)
212
208
  end
213
209
 
214
- dir.close
215
210
 
216
211
  rec_flags = [:create, :moved_to]
217
212
  return watch(path, *((flags - [:recursive]) | rec_flags)) do |event|
@@ -20,5 +20,5 @@
20
20
  # THE SOFTWARE.
21
21
 
22
22
  module INotify
23
- VERSION = '0.11.0'
23
+ VERSION = '0.11.1'
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-inotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum