I'm trying to implement pattern matching, comparing an array of hashes vs. another array of hashes. Each array can have 1 to 3 hashes.
If I have these arrays:
a = [{"name" => "Size", "value" => "S"}, {"name" => "Color", "value" => "Red"}]
b = [{"name" => "Size", "value" => "S"}, {"name" => "Material", "value" => "Cotton"}, {"name" => "Color", "value" => "Red"}]
or another scenario:
a = [{"name" => "Size", "value" => "S"}, {"name" => "Color", "value" => "Red"}, {"name" => "Material", "value" => "Cotton"}]
b = [{"name" => "Size", "value" => "S"}, {"name" => "Material", "value" => "Cotton"}, {"name" => "Color", "value" => "Red"}]
How do I use case/in
to compare them so it returns true? Do I need to convert the hash into be keyed by symbols first?
((a-b) + (b-a)).empty?