Average Hash implementation for Ruby