Method: File.basename
- Defined in:
- file.c
.basename(file_name[, suffix]) ⇒ Object
Returns the last component of the filename given in file_name, which must be formed using forward slashes (“/”) regardless of the separator used on the local file system. If suffix is given and present at the end of file_name, it is removed.
File.basename("/home/gumby/work/ruby.rb") #=> "ruby.rb"
File.basename("/home/gumby/work/ruby.rb", ".rb") #=> "ruby"
2888 2889 2890 |
# File 'file.c', line 2888 static VALUE rb_file_s_basename(argc, argv) int argc; |