DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Easier Path Construction Using Overloaded /
Especially when writing rake tasks where a lot of path construction code is written the following overloading of the / operator makes the code more readable.
class String
def /(other)
File.join(self,other)
end
end
# and you can write
# path = all/along/the/watch/tower
# instead of
# path = "#{all}/#{along}/#{the}/#{watch}/#{tower}"





