Sha256: 1cc2bcd9efc42f9f71de4719551dee7a5966ad587bee9b6d0eea0da417674772

Contents?: true

Size: 324 Bytes

Versions: 22

Compression:

Stored size: 324 Bytes

Contents

module Hiccup
  module CoreExt
    module HashExtensions
      
      def group_by_value
        each_with_object({}) do |(key, value), new_hash|
          (new_hash[value]||=[]).push(key)
        end
      end
      alias :flip :group_by_value
      
    end
  end
end

Hash.send(:include, Hiccup::CoreExt::HashExtensions)

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hiccup-0.5.14 lib/hiccup/core_ext/hash.rb
hiccup-0.5.13 lib/hiccup/core_ext/hash.rb
hiccup-0.5.12 lib/hiccup/core_ext/hash.rb
hiccup-0.5.11 lib/hiccup/core_ext/hash.rb
hiccup-0.5.10 lib/hiccup/core_ext/hash.rb
hiccup-0.5.9 lib/hiccup/core_ext/hash.rb
hiccup-0.5.8 lib/hiccup/core_ext/hash.rb
hiccup-0.5.7 lib/hiccup/core_ext/hash.rb
hiccup-0.5.6 lib/hiccup/core_ext/hash.rb
hiccup-0.5.5 lib/hiccup/core_ext/hash.rb
hiccup-0.5.4 lib/hiccup/core_ext/hash.rb
hiccup-0.5.3 lib/hiccup/core_ext/hash.rb
hiccup-0.5.2 lib/hiccup/core_ext/hash.rb
hiccup-0.5.1 lib/hiccup/core_ext/hash.rb
hiccup-0.5.0 lib/hiccup/core_ext/hash.rb
hiccup-0.4.5 lib/hiccup/core_ext/hash.rb
hiccup-0.4.4 lib/hiccup/core_ext/hash.rb
hiccup-0.4.3 lib/hiccup/core_ext/hash.rb
hiccup-0.4.2 lib/hiccup/core_ext/hash.rb
hiccup-0.4.1 lib/hiccup/core_ext/hash.rb