Added solution in Ruby