Ruby 3.1 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Enumerator::ArithmeticSequenceクラス > size
size -> Integer | nil
有限なら要素数を返します。そうでなければ nil を返します。