Module and protected/private functions

F

Fritz Trapper

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

Robert Dober

Is it possible to declare parts of a module as private or protected to
import these properties via mixin into classes?
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top