user3576036 user3576036 -4 years ago 65
Ruby Question

How to separate the result of addition of string with comma in ruby?

I am trying to assign multiple string values to a variable.
For example:

@default_mail = "sid@mail.com"

@mail = "me@mail.com"


And then I am adding both of these variables and assigning to a new variable. May be this not a very efficient way of doing it:

@reciever = @default_mail + @mail


This gives me.

"sid@mail.comme@mail.com"

But I want this to be an array. How do I do that?

Answer Source

I guess that you want to receive this:

@receiver = [@default_mail, @mail]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download