在此之后,我试图比较两个哈希数组:
db = [
{:foo => "bar", :stack => "overflow", :num => 0.5},
{:foo => "bar", :stack => "underlow", :num => 0.5},
{:foo => "bar", :stack => "overflow", :num => 0.1}
]
csv = [
{:foo => "bar", :stack => "overflow", :num => 0.5},
{:foo => "bar", :stack => "underlow", :num => 0.1},
]
我正在尝试使用 Ruby Set ( db_set = Set[db]
, csv_set = Set[csv]
) 使用-
( db_set - csv_set
) 和&
( db_set & csv_set
) 比较两者,但这些似乎没有执行比较操作。
我误解了使用Set
吗?我如何比较这两个哈希数组?