このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

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

instance method Set#to_a

to_a -> Array[permalink][rdoc][edit]

self を配列に変換します。要素の順序は不定です。

set = Set['hello', 'world']
p set.to_a # => ["hello", "world"]