From: rubikitch@... Date: 2008-02-02T05:26:33+09:00 Subject: [ruby-list:44554] Re: include From: Masatoshi SEKI Subject: [ruby-list:44553] include Date: Sat, 2 Feb 2008 05:14:24 +0900 るびきちです。 > トップレベル(?)でincludeを使うと、どのオブジェクトも > モジュールに定義されているメソッドを呼べてしまう > のでしょうか? public methodだからですね。 module M def m() :m end def n() :n end private :n end include M public_methods.grep(/^m$/) # => ["m"] private_methods.grep(/^n$/) # => ["n"] nil.m # => :m nil.n rescue $! # => # -- rubikitch Blog: http://d.hatena.ne.jp/rubikitch/ Site: http://www.rubyist.net/~rubikitch/