refactor ruby. add list_to_string func