static public Method

File.split(p1)

File.split(file_name)    array

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.

File.split("/home/gumby/.profile")   #=> ["/home/gumby", ".profile"]

Source Code

/*
*  call-seq:
*     File.split(file_name)   => array
*  
*  Splits the given string into a directory and a file component and
*  returns them in a two-element array. See also
*  <code>File::dirname</code> and <code>File::basename</code>.
*     
*     File.split("/home/gumby/.profile")   #=> ["/home/gumby", ".profile"]
*/

static VALUE
rb_file_s_split(klass, path)
   VALUE klass, path;
{
   StringValue(path);          /* get rid of converting twice */
   return rb_assoc_new(rb_file_s_dirname(Qnil, path), rb_file_s_basename(1,&path));
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.