From: "たけ (tk)" Date: 2000-10-28T16:17:58+09:00 Subject: [ruby-list:25663] Re: 拡張ライブラリで定義されているモジュール名は? たけ(tk)です。 》拡張モジュールで定義されているモジュール名、クラス名を知るにはどうすれば 》いいのでしょうか?。  拡張ライブラリのオブジェクトというのはないんでしょうか?。  library = Library.new('win32ole') p library.full_path p library.defined_modules p library.defined_classes  そのライブラリのルートのモジュールやクラスが分かればそこからたどっていっ てすべてのクラスを調べることが出来る。しかし、ルートの名前が分からないと 何も調べられない。  * 「拡張モジュール」ではなく「拡張ライブラリ」というんですね。  −−  それと、「現在使用可能なモジュール・クラスのリスト」というのはないので しょうか?。 p modules p classes # cf.  p constants p methods  −−  次のスクリプトで出てくるものが「その時点で利用可能なクラスとモジュール」 であると考えてもいいのでしょうか?。 #---- modules = [] classes = [] c = Object.constants.sort c.each{ |o| modules += [o] if eval(o).type == Module classes += [o] if eval(o).type == Class } p "modules" p modules p "classes" p classes #---- "modules" ["Comparable", "Enumerable", "Errno", "FileTest", "GC", "Kernel", "Marshal", "Math", "ObjectSpace", "Precision", "Process"] "classes" ["ArgumentError", "Array", "Bignum", "Binding", "Class", "Continuation", "Data", "Dir", "EOFError", "Exception", "FalseClass", "File", "Fixnum", "Float", "FloatDomainError", "Hash", "IO", "IOError", "IndexError", "Integer", "Interrupt", "LoadError", "LocalJumpError", "MatchData", "MatchingData", "Method", "Module", "NameError", "NilClass", "NoMemoryError", "NotImplementError", "NotImplementedError", "Numeric", "Object", "Proc", "Range", "RangeError", "Regexp", "RegexpError", "RuntimeError", "ScriptError", "SecurityError", "SignalException", "StandardError", "String", "Struct", "Symbol", "SyntaxError", "SystemCallError", "SystemExit", "SystemStackError", "Thread", "ThreadError", "ThreadGroup", "Time", "TrueClass", "TypeError", "UnboundMethod", "ZeroDivisionError"] たけ(tk) ggb03124@nifty.ne.jp http://member.nifty.ne.jp/take_tk