Method: File.split_root

Defined in:
lib/core/facets/file/split_root.rb

.split_root(path) ⇒ Object

Return the head of path from the rest of the path.

File.split_root('etc/xdg/gtk')  #=> ['etc', 'xdg/gtk']


7
8
9
10
# File 'lib/core/facets/file/split_root.rb', line 7

def self.split_root(path)
  path_re = Regexp.new('[' + Regexp.escape(File::Separator + %q{\/}) + ']')
  path.split(path_re, 2)
end