script to refactor Ruby