added Ruby solution, changed methods names