Class: Pathname
- Inherits:
-
Object
- Object
- Pathname
- Defined in:
- lib/homeconf/pathname.rb
Overview
Pathname mix-ins for homeconf.
Instance Method Summary collapse
-
#path_prefix?(path_prefix) ⇒ Boolean
Returns whether
selfhas the path prefix ofpath_prefix.
Instance Method Details
#path_prefix?(path_prefix) ⇒ Boolean
Returns whether self has the path prefix of path_prefix
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/homeconf/pathname.rb', line 8 def path_prefix?(path_prefix) path_parts = .parent.to_s.split(File::SEPARATOR) prefix_parts = File.(path_prefix).split(File::SEPARATOR) return false if path_parts.size < prefix_parts.size prefix_parts.each_with_index do |part, index| return false unless path_parts[index].eql? part end true end |