File: array.rb

package info (click to toggle)
ruby-acts-as-taggable-on 11.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 596 kB
  • sloc: ruby: 3,924; makefile: 8
file content (9 lines) | stat: -rw-r--r-- 128 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
unless [].respond_to?(:freq)
  class Array
    def freq
      k=Hash.new(0)
      each { |e| k[e]+=1 }
      k
    end
  end
end