I am having trouble with the syntax for reduce. I have a hash of the following format:
H = {\"Key1\" => 1, \"Key2\" => 2}
I would like t
h = {"Key1" => 1, "Key2" => 2} h.values.inject(0){|f,v| f += v.to_i } # => 3
or
h.values.inject(:+) # => 3