Ruby:从文件中读取行并将它们拆分为结构

Ruby: Reading Lines from File Splitting them into Struct

我有一个我想阅读的文本文件,该文件以这种格式分隔 "Item1", 1 "Item2", 34 "Item3", 6 等等

我想将行的每一部分输入到我的 Struct 的新实例中。我应该使用什么语法来完成这个?我正在撞墙。

Item = Struct.new(:name, :price)
File.readlines('MASTER_INVENTORY.txt').map do |line|
  Item.new << line.split
end
Item = Struct.new(:name, :price)
File.readlines('MASTER_INVENTORY.txt').map do |line|
  line.scan(/"(.*?)",\s*(\S*)/).map do |item, price|
    Item.new(item, price.to_i)
  end
end