ruby code from bob exercism