Issue #7349 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned
Assignee set to matz (Yukihiro Matsumoto)


----------------------------------------
Feature #7349: Struct#inspect needs more meaningful output
https://bugs.ruby-lang.org/issues/7349#change-33837

Author: postmodern (Hal Brodigan)
Status: Assigned
Priority: Low
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


When inheriting directly from Struct.new, Class#ancestors shows a meaningless anonymous Class:

    class Point < Struct.new(:x, :y)

      def distance
        ((x ** 2) + (y ** 2)) ** 0.5
      end

    end

    Point.ancestors
    # => [Point, #<Class:0x007fe204a1a228>, Struct, Enumerable, Object, Kernel, BasicObject]

Perhaps, the anonymous Class could list the Struct's fields?

    #<Class:x, y>



-- 
http://bugs.ruby-lang.org/