字符串无法写入CSV文件Ruby

字符串无法写入CSV文件Ruby,ruby,arrays,csv,Ruby,Arrays,Csv,我不一定理解为什么这段代码是不正确的。我知道string类中的错误没有方法映射。但我很难对这个错误保持清醒 错误 `<<': undefined method `map' for #<String:0x000001020b8940> (NoMethodError) `接受数组或数组。将字符串转换为数组 csv << [string] csv csv << [string]

我不一定理解为什么这段代码是不正确的。我知道string类中的错误没有方法映射。但我很难对这个错误保持清醒

错误

`<<': undefined method `map' for #<String:0x000001020b8940> (NoMethodError)
`接受数组或数组。将字符串转换为数组

csv << [string]
csv
csv << [string]