class Pathname

Public Instance Methods

basename_sub(suffix = '') { |basename(suffix)| ... } click to toggle source
# File lib/eac_ruby_utils/patches/pathname/basename_sub.rb, line 6
def basename_sub(suffix = '')
  parent.join(yield(basename(suffix)))
end
parent_n(n) click to toggle source

Apply .parent n times. @return [Pathname]

# File lib/eac_ruby_utils/patches/pathname/parent_n.rb, line 8
def parent_n(n) # rubocop:disable Naming/MethodParameterName
  n.times.inject(self) { |a, _e| a.parent }
end