Skip to content
instance method

Set#to_s

() -> ::String
to_s

Alias of #inspect

Returns a new string containing the set entries:

Example
s = Set.new
s.inspect # => "Set[]"
s.add(1)
s.inspect # => "Set[1]"
s.add(2)
s.inspect # => "Set[1, 2]"

Related: see Methods for Converting.

See also #inspect #to_json #to_set #to_a also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0