Actions
Backport #954
closedOpenStruct#inspect recursion detection is buggy
Status:
Closed
Assignee:
Description
=begin
Currently, OpenStruct#inspect shows a recursion indicator whenever a member of an OpenStruct is an OpenStruct itself:
foo = OpenStruct.new
foo.bar = OpenStruct.new
foo.inspect # => #<OpenStruct bar=#<OpenStruct ...>>
I expect it to do the following:
foo = OpenStruct.new
foo.bar = OpenStruct.new
assert_equal('#<OpenStruct bar=#>', foo.inspect)
foo.bar.foo = foo
assert_equal('#<OpenStruct bar=#<OpenStruct foo=#<OpenStruct ...>>>', foo.inspect)
Path attached. It uses the code pattern found in Set#inspect, using object_ids instead of objects for the :inspect_key stack.
It should be fixed in Ruby 1.8.6 and 1.8.7, too.
=end
Files
Actions
Like0
Like0Like0Like0Like0