class method
File.split
(::string | ::_ToPath file_name) -> [ ::String, ::String ]
File.split(file_name) → array
file.c
View on GitHub ↗
static VALUE
rb_file_s_split(VALUE klass, VALUE path)
{
FilePathStringValue(path); /* get rid of converting twice */
return rb_assoc_new(rb_file_dirname(path), rb_file_s_basename(1,&path,Qundef));
}
Splits the given string into a directory and a file component and returns them in a two-element array. See also File::dirname and File::basename.
Example
File.split("/home/gumby/.profile") #=> ["/home/gumby", ".profile"]