I have an array of instances of e.g. class Result, I want to join names of results rather than results with a ',' like below:
@results=[result1, result2...]
results.join(", ") do |r|
r.name
end
results.join method should be an extensino methods of Array, I want it available to all arrays in my program.
Possible?
#joinis already an array method... what are you asking for exactly?joindoes not take a block. You need to usecollectand thenjoin.