Striping last directory from path with regex in Ruby?

Viewed 5320

I have a list of documents that I've collected using Dir.glob in Rails 3.

The result is a list of paths similar to the following:

/home/danny/nurserotas/GREEN WEEK 2ND JAN 2012.xls

What I would like to achieve is striping everything up, and including, the last forward slash. So the result for the above path is:

GREEN WEEK 2ND JAN 2012.xls

I'm going to be using these as links so I'm not sure if replacing the spaces with %20 is a good idea or not.

Any help would be appreciated!

2 Answers
Related