mruby-enum-ext: tally should respect multi-values; fix #6507

This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-04-05 22:12:51 +09:00
parent cb8cd9388c
commit dd68681002
+2 -1
View File
@@ -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