Path Extensions To help you create rakefiles, Rake provides some extensions to the existing String class in Ruby. One of these exensions is the ”ext” method which makes changing up a file’s extension quick and easy. For example, we might want to convert a source file name into a target file name. We can easily do that like so: "myfile.c".ext "o" This will convert the file extension of the ”.c” file to a ”.o” file. Take note that this method modifies the String in place so the object itself will be modified rather than just returning a modified String. For more advanced path manip- ulation you can use the ”pathmap” method which takes in a format string to explain how you would like to change the path of a file. Here is an example of the more advanced ”pathmap” method: 1 "myfile.c".pathmap "%X.o"
- jcran