aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/file_evented_update_checker.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2015-11-10 07:38:38 -0800
committerXavier Noria <fxn@hashref.com>2015-11-10 22:19:36 +0100
commitfe918b3bc4554693e16a536c91480db92ea35440 (patch)
tree71ab5f1a1e8e8b7a44cf0e5ce7518e499b9461fd /activesupport/lib/active_support/file_evented_update_checker.rb
parent4e1cff0e20c473edcd5cbb3ca344284bb5f428c0 (diff)
downloadrails-fe918b3bc4554693e16a536c91480db92ea35440.tar.gz
rails-fe918b3bc4554693e16a536c91480db92ea35440.tar.bz2
rails-fe918b3bc4554693e16a536c91480db92ea35440.zip
simplifies the implementation of existing parent
Diffstat (limited to 'activesupport/lib/active_support/file_evented_update_checker.rb')
-rw-r--r--activesupport/lib/active_support/file_evented_update_checker.rb15
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