Looping through an array while adding the data to a string and finally returning it, a faster way?
- by Hadi
Getting the customer's to_s method by looping through
Is there a Ruby idiom to write the code in 1 line (or shorter than 3 lines of code)?
def method
string = ""
@customers.each { |customer| string += customer.to_s + "\n" }
string
end