What does the (unary) * operator do in this Ruby code?

Given the Ruby code

line = "first_name=mickey;last_name=mouse;country=usa" 
record = Hash[*line.split(/=|;/)] 

I understand everything in the second line apart from the * operator – what is it doing and where is the documentation for this? (as you might guess, searching for this case is proving hard…)

Best Answer

Leave a Comment