Method: File.extname

Defined in:
file.c

.extname(path) ⇒ String

Returns the extension (the portion of file name in path after the period).

File.extname("test.rb")         #=> ".rb"
File.extname("a/b/d/test.rb")   #=> ".rb"
File.extname("test")            #=> ""
File.extname(".profile")        #=> ""

Returns:



3019
3020
3021
# File 'file.c', line 3019

static VALUE
rb_file_s_extname(klass, fname)
VALUE klass, fname;