提交 40a1945d 编写于 作者: X Xavier Noria

simplifies the implementation of #watching?

上级 0eb6d198
......@@ -50,23 +50,19 @@ def changed(modified, added, removed)
def watching?(file)
file = @ph.xpath(file)
return true if @files.member?(file)
return false if file.directory?
ext = @ph.normalize_extension(file.extname)
dir = file.dirname
loop do
if @dirs.fetch(dir, []).include?(ext)
break true
else
if @lcsp
break false if dir == @lcsp
else
break false if dir.root?
if @files.member?(file)
true
elsif file.directory?
false
else
ext = @ph.normalize_extension(file.extname)
file.dirname.ascend do |dir|
if @dirs.fetch(dir, []).include?(ext)
break true
elsif dir == @lcsp || dir.root?
break false
end
dir = dir.parent
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册