cybo
September 13th, 2010, 01:12 PM
i'm trying to learn ruby and i have a question about the following code
data = []
line = "first_name=david;last_name=black;country=usa"
record = Hash[*line.split(/=|;/)]
data.push(record)
what does the '*' mean in the hash creation? what does it do?
i.e. the following line
|----------- what does this star do?
|
record = Hash[*line.split(/=|;/)]
help is appreciated
data = []
line = "first_name=david;last_name=black;country=usa"
record = Hash[*line.split(/=|;/)]
data.push(record)
what does the '*' mean in the hash creation? what does it do?
i.e. the following line
|----------- what does this star do?
|
record = Hash[*line.split(/=|;/)]
help is appreciated