From: matz@... (Yukihiro Matsumoto) Date: 2001-05-09T18:21:12+09:00 Subject: [ruby-talk:14907] Re: Class/Module Information Hi, In message "[ruby-talk:14881] Class/Module Information" on 01/05/09, "John Kaurin" writes: |Actual Output: | |Name ................. "C" |Included Modules ..... [B, A] |Constants ............ ["CONSTANT_C", "CONSTANT_B", "CONSTANT_A"] |Class Variables ...... ["@@class_c", "@@class_b", "@@class_a"] |Instance Variables ... [] |Instance Methods ..... ["func_c"] | |Desired Output: | |Name ................. "C" |Included Modules ..... [B] |Constants ............ ["CONSTANT_C"] |Class Variables ...... ["@@class_c"] |Instance Variables ... ["@var_c"] |Instance Methods ..... ["func_c"] Confucius once said "accept things as they are". ;-) Anyway, let me think about things. Included Modules: current Ruby implementation does not distinguish direct included modules (B, this case) and indirect included modules (A, this case). Constants: you can get this information by c = C.constants C.included_modules.each{|m| c -= m.constants} Class Variables: same as above. it might be useful to add optional argument to restrict search for this class/module only. Instance Variables: In Ruby, instance variables belong to each instance, not a class nor module, so that you can get their information from module. matz.