I have an array of hashes where each hash is a list of URL parameters from URI::decode_www_form. I want to remove duplicates in this array so that all hashes inside the array have unique parameter keys.
For example if I have
arr = [{"update" => "1", "reload" => "true"},
{"update" => "5", "reload" => "false"},
{"update" => "9", "reload" => "false"},
{"update" => "7", "reload" => "true", "newvalue" => "11111"},
{"page" => "1"}]
I would expect to have an array containing only:
arr = [{"update" => "1", "reload" => "true"},
{"update" => "7", "reload" => "true", "newvalue" => "11111"},
{"page" => "1"}]
Where the first three entries are duplicates of each other so only keep one of them, the fourth being unique since it has an extra unique key the first three did not have, and the fifth being unique since it is not the same as any of them.
How would I attempt to solve this problem?