Class: Pathname
Instance Method Summary collapse
-
#find_matching_parent {|path| ... } ⇒ Pathname?
Returns the path object that is the first parent of self matching the given predicate.
Instance Method Details
#find_matching_parent {|path| ... } ⇒ Pathname?
Returns the path object that is the first parent of self matching the given predicate
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/utilrb/pathname/find_matching_parent.rb', line 10 def find_matching_parent # Look for a bundle in the parents of Dir.pwd curdir = self while !curdir.root? && !yield(curdir) curdir = curdir.parent end if !curdir.root? curdir end end |