mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
15 lines
422 B
Ruby
15 lines
422 B
Ruby
![]() |
# typed: strict
|
||
|
# frozen_string_literal: true
|
||
|
|
||
|
module Utils
|
||
|
module Path
|
||
|
sig { params(parent: T.any(Pathname, String), child: T.any(Pathname, String)).returns(T::Boolean) }
|
||
|
def self.child_of?(parent, child)
|
||
|
parent_pathname = Pathname(parent).expand_path
|
||
|
child_pathname = Pathname(child).expand_path
|
||
|
child_pathname.ascend { |p| return true if p == parent_pathname }
|
||
|
false
|
||
|
end
|
||
|
end
|
||
|
end
|