diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/file_evented_update_checker.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/activesupport/lib/active_support/file_evented_update_checker.rb b/activesupport/lib/active_support/file_evented_update_checker.rb index 8f734ac4e4..51c8cf5690 100644 --- a/activesupport/lib/active_support/file_evented_update_checker.rb +++ b/activesupport/lib/active_support/file_evented_update_checker.rb @@ -126,19 +126,8 @@ module ActiveSupport # Returns the deepest existing ascendant, which could be the argument itself. def existing_parent(dir) - loop do - if dir.directory? - break dir - else - if dir.root? - # Edge case in which not even the root exists. For example, Windows - # paths could have a non-existing drive letter. Since the parent of - # root is root, we need to break to prevent an infinite loop. - break - else - dir = dir.parent - end - end + dir.ascend do |ascendant| + break ascendant if ascendant.directory? end end |