class Array
Taken from: github.com/rubyworks/facets/blob/master/lib/core/facets/array/mode.rb#L14
Public Instance Methods
mode()
click to toggle source
Get most common value from an array If there is a tie for most common, an array is returned of the tied values
# File lib/openstudio-standards/utilities/array.rb, line 5 def mode max = 0 c = Hash.new 0 each { |x| cc = c[x] += 1; max = cc if cc > max } c.select { |k, v| v == max }.map { |k, v| k } end