Method: FileUtils#split_all

Defined in:
lib/rake/file_utils.rb

#split_all(path) ⇒ Object

Split a file path into individual directory names.

Example:

split_all("a/b/c") =>  ['a', 'b', 'c']


126
127
128
129
130
131
# File 'lib/rake/file_utils.rb', line 126

def split_all(path)
  head, tail = File.split(path)
  return [tail] if head == "." || tail == "/"
  return [head, tail] if head == "/"
  return split_all(head) + [tail]
end