Class: Pathname
- Defined in:
- lib/eac_ruby_utils/patches/pathname/parent_n.rb,
lib/eac_ruby_utils/patches/pathname/basename_sub.rb
Direct Known Subclasses
EacRubyUtils::Fs::ClearableDirectory, EacRubyUtils::Fs::Temp::File
Instance Method Summary collapse
- #basename_sub(suffix = '') ⇒ Object
-
#parent_n(n) ⇒ Pathname
Apply .parent n times.
Instance Method Details
#basename_sub(suffix = '') ⇒ Object
6 7 8 |
# 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) ⇒ Pathname
Apply .parent n times.
8 9 10 |
# 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 |