Looking for an answer that works on Ruby 1.8.7 :
For example lets say I have a hash like this:
{"Book Y"=>["author B", "author C"], "Book X"=>["author A", "author B", "author C"]}
and I want to get this:
{
"author A" => ["Book X"],
"author B" => ["Book Y", "Book X"],
"author C" => ["Book Y", "Book X"]
}
I wrote a really long method for it, but with large datasets, it is super slow.
Any elegant solutions?