class Pathname
Public Instance Methods
add_ext(ext_str)
click to toggle source
# File lib/adlint/prelude.rb, line 143 def add_ext(ext_str) Pathname.new(self.to_s + ext_str) end
components()
click to toggle source
# File lib/adlint/prelude.rb, line 124 def components self.each_filename.to_a end
identical?(rhs)
click to toggle source
# File lib/adlint/prelude.rb, line 147 def identical?(rhs) case rhs when Pathname self.cleanpath == rhs.cleanpath when String self.cleanpath == Pathname.new(rhs).cleanpath else false end end
real_components()
click to toggle source
# File lib/adlint/prelude.rb, line 129 def real_components self.realpath.each_filename.to_a end
strip(num = 0)
click to toggle source
# File lib/adlint/prelude.rb, line 137 def strip(num = 0) comps = self.components comps = comps.slice(num..-1) if num >= 0 && num < comps.size Pathname.new(comps.reduce { |stripped, comp| File.join(stripped, comp) }) end
under?(parent_dpath)
click to toggle source
# File lib/adlint/prelude.rb, line 159 def under?(parent_dpath) lhs_comps, rhs_comps = self.real_components, parent_dpath.real_components if rhs_comps.size < lhs_comps.size rhs_comps.zip(lhs_comps).all? { |rhs, lhs| lhs == rhs } else false end end