mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-enum-ext: tally should respect multi-values; fix #6507
This commit is contained in:
@@ -851,7 +851,8 @@ module Enumerable
|
||||
# ["a", "b", "c", "b"].tally #=> {"a"=>1, "b"=>2, "c"=>1}
|
||||
def tally
|
||||
hash = {}
|
||||
self.each do |x|
|
||||
self.each do |*x|
|
||||
x = x.__svalue
|
||||
hash[x] = (hash[x]||0)+1
|
||||
end
|
||||
hash
|
||||
|
||||
Reference in New Issue
Block a user