Ruby 4.0 リファレンスマニュアル

instance method NilClass#to_a

to_a -> Array[permalink][rdoc][edit]
() → [ ]

空配列 [] を返します。

p nil.to_a # => []