Hello all!
Can this be done better/nicer?
In @person i have an array of telephones. telephone is a hash with an id and a number, and i would like to join them.
Hello all!
Can this be done better/nicer?
In @person i have an array of telephones. telephone is a hash with an id
and a number, and i would like to join them.
Hello all!
Can this be done better/nicer?
In @person i have an array of telephones. telephone is a hash with an
id and a number, and i would like to join them.
If telephone (x) is indeed a hash, the above would not work. It seems
like telephone is a struct. Right?
Then why don;t you do
@person.telephones.map {|x| x.number}.join(', ')
cheers,
Brian
···
On 07/11/05, Francesco <fran.cy@libero.it.invalid> wrote:
Hello all!
Can this be done better/nicer?
In @person i have an array of telephones. telephone is a hash with an id
and a number, and i would like to join them.
On Mon, 07 Nov 2005 19:22:13 +0100, Francesco <fran.cy@libero.it.invalid> wrote:
Hello all!
Can this be done better/nicer?
In @person i have an array of telephones. telephone is a hash with an id and a number, and i would like to join them.
Thank you all! You all gave the same answer, so that must be the correct way
I don't know why I created that array... Maybe I was thinking too long about that problem.