string manipulation in ruby is hard