From: "mame (Yusuke Endoh)" Date: 2012-11-25T10:51:28+09:00 Subject: [ruby-core:50059] [ruby-trunk - Feature #7349] Struct#inspect needs more meaningful output Issue #7349 has been updated by mame (Yusuke Endoh). This is not a bug. This ticket has been moved to the feature tracker. I'm not against this proposal, but I don't think that people normally check the singleton class to know Struct fields. You may want to use Struct.#members: p Point.members #=> [:x, :y] It is shorter than ancestors. -- Yusuke Endoh ---------------------------------------- Feature #7349: Struct#inspect needs more meaningful output https://bugs.ruby-lang.org/issues/7349#change-33838 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, #, Struct, Enumerable, Object, Kernel, BasicObject] Perhaps, the anonymous Class could list the Struct's fields? # -- http://bugs.ruby-lang.org/