From: benny Date: 2005-08-02T04:21:04+09:00 Subject: Recursive OpenStruct Dear list, didn't find anything like that so I thought, I could be useful to somebody: You'll find a little recursive OpenStruct class below. It allows you to generate an (pseudo)attribut based hierarchy on the fly. the calling of the "attribut" is sufficious to generate it (you don't have to set it to a certain value). the object might later go back through this tree. might be useful for settings as an alternative way to recursive hashes. regards, benny require 'ostruct' class ROpenStruct < OpenStruct def method_missing(mid, *args) mname = mid.id2name len = args.length if len == 0 @table[mname.intern] = ROpenStruct.new self.new_ostruct_member(mname) @table[mname.intern] else super end end end test = ROpenStruct.new test.p = "hello" test.t.s.p.t.z.y.x = "hi" test.xyz p test