Module: Hiccup::CoreExt::HashExtensions

Defined in:
lib/hiccup/core_ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#group_by_valueObject Also known as: flip



5
6
7
8
9
# File 'lib/hiccup/core_ext/hash.rb', line 5

def group_by_value
  each_with_object({}) do |(key, value), new_hash|
    (new_hash[value]||=[]).push(key)
  end
end