Module and protected/private functions

Is it possible to declare parts of a module as private or protected to
import these properties via mixin into classes?

On Sun, Aug 22, 2010 at 2:35 PM, Fritz T. wrote:

Is it possible to declare parts of a module as private or protected to
import these properties via mixin into classes?

Posted via http://www.ruby-forum.com/.

as a matter of fact it is,

module M
def a; end
protected
def aa; end
private
def aaa; end
end
=> nil
include M
=> Object
private_methods.grep /\Aa/
=> [:aaa, :at_exit, :abort, :autoload, :autoload?]
protected_methods.grep /\Aa/
=> [:aa]
methods.grep /\Aa/
=> [:a, :aa]

HTH
Robert