diff options
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/file_evented_update_checker.rb | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/activesupport/lib/active_support/file_evented_update_checker.rb b/activesupport/lib/active_support/file_evented_update_checker.rb index 8cb422ad36..6375de4a7d 100644 --- a/activesupport/lib/active_support/file_evented_update_checker.rb +++ b/activesupport/lib/active_support/file_evented_update_checker.rb @@ -50,23 +50,19 @@ module ActiveSupport 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 |