ruby solution