Class: Snuffle::Util::Histogram

Inherits:
Object
  • Object
show all
Defined in:
lib/snuffle/util/histogram.rb

Class Method Summary collapse

Class Method Details

.from(arrays) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/snuffle/util/histogram.rb', line 6

def self.from(arrays)
  arrays.flatten.inject({}) do |h, value|
    h[value] ||= 0;
    h[value] += 1
    h
  end
end