Let's say I have a hash:
{
first: :value1,
second: :value1,
third: :value2
}
During .map
I need to eliminate duplicates so it should be either first
or second
only. Is it possible to have some workaround like:
{
(:first || :second) => :value1,
third: :value2
}
If not, how can I remove key duplicates in a hash based on condition? Is it possible to pass a condition into the .uniq
block?
Thanks,