From: Yukihiro Matsumoto Date: 2006-01-17T14:19:53+09:00 Subject: [ruby-dev:28226] Re: const_defined? behavior まつもと ゆきひろです In message "Re: [ruby-dev:28225] Re: const_defined? behavior" on Tue, 17 Jan 2006 14:15:34 +0900, nobuyoshi nakada writes: |At Mon, 16 Jan 2006 17:05:29 +0900, |Daniel Amelang wrote in [ruby-talk:175899]: |> Is this the intended behavior of const_defined? |> |> >> IO::SYNC |> => 4096 |> >> IO.const_defined? :SYNC |> => false |> |> It appears that const_defined? only returns true if the class is the |> originator of the constant. If the constant was borrowed from |> somewhere else (in this case, File::Constants), it returns false. | |Module#const_get でも mod::CONST 形式でも、継承した定数を無視す |ることはないので、 const_defined? だけが例外になっています。デ |フォルトは const_get に合わせて、省略可能な引数で継承した定数を |無視できるようにするのはどうでしょうか。 1.9でお願いします。 |method_defined? もちょっと悩ましいですが。 これも同じでいいんじゃないですかね。