Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Set#inspect
() -> ::String
inspect
lib/set.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/set.rb, line 814
def inspect
ids = (Thread.current[InspectKey] ||= [])
if ids.include?(object_id)
return sprintf('#<%s: {...}>', self.class.name)
end
ids << object_id
begin
return sprintf('#<%s: {%s}>', self.class, to_a.inspect[1..-2])
ensure
ids.pop
end
end
Returns a string containing a human-readable representation of the set (“#<Set: {element1, element2, …}>”).
See also
#initialize_dup
#intersect?
#initialize_clone
#intersection
also in
4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0