Sha256: d4064e35e1d86ccd36488a6f946938339b2475ddd23f92a6ac5ae840ebecb54f
Contents?: true
Size: 473 Bytes
Versions: 10
Compression:
Stored size: 473 Bytes
Contents
class File # Splits a file path into an array of individual path components. # This differs from <tt>File.split</tt>, which divides the path into # only two parts, directory path and basename. # # File.split_all("a/b/c") => ['a', 'b', 'c'] # # CREDIT: Trans def self.split_all(path) head, tail = File.split(path) return [tail] if head == '.' || tail == '/' return [head, tail] if head == '/' return split_all(head) + [tail] end end
Version data entries
10 entries across 10 versions & 1 rubygems