Sha256: f6d45da9b7651521dfca8046a434844cd5c03acb41f752ada95e69d88cf83fd0

Contents?: true

Size: 312 Bytes

Versions: 8

Compression:

Stored size: 312 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

8 entries across 8 versions & 1 rubygems

Version Path
hiccup-0.6.1 lib/hiccup/core_ext/hash.rb
hiccup-0.6.0 lib/hiccup/core_ext/hash.rb
hiccup-0.5.20 lib/hiccup/core_ext/hash.rb
hiccup-0.5.19 lib/hiccup/core_ext/hash.rb
hiccup-0.5.18 lib/hiccup/core_ext/hash.rb
hiccup-0.5.17 lib/hiccup/core_ext/hash.rb
hiccup-0.5.16 lib/hiccup/core_ext/hash.rb
hiccup-0.5.15 lib/hiccup/core_ext/hash.rb