Sha256: ee76a5adec414ea00c8110267cf8fad07b8c075a13b4f7194fa37c60982fabf5
Contents?: true
Size: 429 Bytes
Versions: 6
Compression:
Stored size: 429 Bytes
Contents
unless (File.dirname("", 0) rescue false) require 'backports/tools/alias_method_chain' class File def self.dirname_with_depth(path, depth = 1) return dirname_without_depth(path) if depth == 1 raise ArgumentError, "negative depth #{depth}" if depth < 0 depth.times { path = dirname_without_depth(path) } path end Backports.alias_method_chain singleton_class, :dirname, :depth end end
Version data entries
6 entries across 6 versions & 1 rubygems