Sha256: d146f5fc186e51beb2ddebcbc0f58d655f3bd3cd024b7bae6a317f7e8265db71

Contents?: true

Size: 421 Bytes

Versions: 22

Compression:

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

22 entries across 22 versions & 1 rubygems

Version Path
hiccup-0.4.0 lib/hiccup/core_ext/enumerable.rb
hiccup-0.3.0 lib/hiccup/core_ext/enumerable.rb