Optimizing Ruby Path Methods