Google

def length c = 0 each_attribute { c+=1} c end