Is there a more efficient way to extract the file extensions in ruby? I currently do the following.
RUBY:
-
ext = File.basename(filepath).reverse.split('.')[0].reverse
shajith says:
Try File.extname(filepath).
Tip: Use something.methods to peek at what is available. And set up the ri documentation base so you can query for docs (as in: ri File.extname)
August 7, 2006, 7:56 am