class statistics code in ruby