converting c into ruby