我有一个散列数组,每个散列都有一个lol
具有整数值的键。我想对这些值求和,注入总是有效,但现在我得到了一个例外:
array = [{lol: 1}, {lol: 2}]
array.inject {|memo, (key, value)| memo + value} =>
NoMethodError: undefined method `+' for {:lol=>1}:Hash
from (irb):26:in `block in irb_binding'
from (irb):26:in `each'
from (irb):26:in `inject'
from (irb):26
猪肉?