Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Set#to_a
() -> ::Array[A]
to_a
lib/set.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/set.rb, line 342
def to_a
@hash.keys
end
Returns an array containing all elements in the set.
Example
Set[1, 2].to_a #=> [1, 2] Set[1, 'c', :s].to_a #=> [1, "c", :s]