Eric Hodel wrote: >> The reason is that the pp-library uses the members method of the >> created structure to enumerate the members. The problem is easy to fix >> by using the members method on the class instead. The documentation >> for Struct suggest that you should use members in the said way >> however, and it's not clear (to me) that Struct.new(:members) >> overrides this. > class Struct > def pretty_print(q) > q.group(1, '#<struct ' + self.class.name, '>') { > - q.seplist(self.members, lambda { q.text "," }) {|member| > + q.seplist(self.class.members, lambda { q.text "," }) {|member| irb(main):001:0> Struct.new(:class).new.class => nil The right way to fix it is by using Object.instance_method(:class).bind(self).call.members IMHO. But it's probably quite a rare case anyway... :) -- http://flgr.0x42.net/