Sha256: 3314ae092171c9c87a77aaac15753ac935eabf1d884ee8a77679ba05bf52e9bb
Contents?: true
Size: 190 Bytes
Versions: 1
Compression:
Stored size: 190 Bytes
Contents
class Array # [1,2,1,3].to_hash #=> {1 => 2, 2 => 1, 3 => 1} def to_hash self.inject({}) do |hash, ele| hash[ele] = hash[ele] ? hash[ele] + 1 : 1 hash end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
SEstimator-0.1.0 | lib/SEstimator/support/Array.rb |