File.basename(file_name [, suffix] ) â base_name
Class Public methods
Returns the last component of the filename given in file_name,
which can be formed using both File::SEPARATOR and
File::ALT_SEPARETOR as the separator when
File::ALT_SEPARATOR is not nil. 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"
Please login to continue.