smart array in ruby