From: "Eregon (Benoit Daloze)" Date: 2012-11-16T08:19:34+09:00 Subject: [ruby-core:49397] [ruby-trunk - Bug #7349] Struct#inspect needs more meaningful output Issue #7349 has been updated by Eregon (Benoit Daloze). It might be worth pointing out that this should not happen if the Struct generated class is assigned to a constant (and so one level of inheritance is not unused): Point = Struct.new(:x, :y) do def distance Math.hypot(x,y) end end ---------------------------------------- Bug #7349: Struct#inspect needs more meaningful output https://bugs.ruby-lang.org/issues/7349#change-32944 Author: postmodern (Hal Brodigan) Status: Open Priority: Low Assignee: Category: core Target version: next minor ruby -v: ruby 2.0.0dev (2012-11-01 trunk 37411) [x86_64-linux] 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/