Sha256: 8b0ba0c5ec846eab2ada3dded96e93225eff6d2e32e600ec19ff4683884475ad

Contents?: true

Size: 235 Bytes

Versions: 227

Compression:

Stored size: 235 Bytes

Contents

# frozen_string_literal: true

require 'pathname'

class Pathname
  # Apply .parent n times.
  # @return [Pathname]
  def parent_n(n) # rubocop:disable Naming/MethodParameterName
    n.times.inject(self) { |a, _e| a.parent }
  end
end

Version data entries

227 entries across 227 versions & 4 rubygems

Version Path
eac_ruby_utils-0.124.0 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.97.2 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_ruby_utils-0.123.0 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_ruby_utils-0.121.0 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_ruby_utils-0.120.0 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.76.1 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.76.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.75.2 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_ruby_utils-0.119.2 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.75.1 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.75.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_ruby_utils-0.119.1 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.74.1 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.74.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.73.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_ruby_utils-0.119.0 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.72.0 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_ruby_utils-0.118.1 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_ruby_utils-0.118.0 lib/eac_ruby_utils/patches/pathname/parent_n.rb
eac_tools-0.70.1 sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/parent_n.rb