Skip to content

Instantly share code, notes, and snippets.

@mururu mururu/add_up.rb
Created May 5, 2012

Embed
What would you like to do?
配列の各要素数をカウントするやつ
class Array
def add_up
Hash.new(0).tap{|h| self.each{|v| h[v]+=1 } }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.