From: Andrea Dallera Date: 2011-03-22T22:03:41+09:00 Subject: Re: summing values in a hash? There's no built in method to do that. You can do it with: hash = { :a => 1, :b => 6, :c => 20 } p hash.inject(0) { |sum, tuple| sum += tuple[1] } # => 27 On Tuesday, March 22, 2011 01:57:27 pm Jen wrote: > Hi, > > Is there an inbuilt method to sum all values in a hash and return the > result? > > I.E something like puts hash[values].sum > > If so could someone please point me at the correct section of the ruby > docs? > > thanks, > Jen.