hi
There is an array of strings
paths = ['foo/bar_baz/_sunny', bar/foo_baz/_warm', 'foo/baz/_cold', etc etc]
I need to remove underscore in each last part of path (_sunny => sunny, _warm => warm, _cold => cold)
paths.each do |path| path_parts = path.split('/') path_parts.last.sub!(/^_/, '') puts path_parts.join('/') end
However that solution is a bit dirty. I feel it can be done without using path.split and path.join. Do you have any ideas?
Thanks in advance