Sha256: f74208d5224706262951b2549a81401ae4159701c75b8e2841406385043700a6

Contents?: true

Size: 409 Bytes

Versions: 8

Compression:

Stored size: 409 Bytes

Contents

module Hiccup
  module CoreExt
    module EnumerableExtensions

      def to_histogram
        self.each_with_object(Hash.new { 0 }) do |item, histogram|
          pattern = block_given? ? yield(item) : item
          histogram[pattern] += 1
        end
      end

    end
  end
end

Enumerable.send(:include, Hiccup::CoreExt::EnumerableExtensions)
Array.send(:include, Hiccup::CoreExt::EnumerableExtensions)

Version data entries

8 entries across 8 versions & 1 rubygems

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