Overly complicated logic to handle ruby paths