Prevents multiple includes of the same module

Z

Zouplaz

Hello, one module defines several CONSTANTS
As it is required from few classes I get
warning: already initialized constant FOO

How can I prevents the redefinition of theses CONSTANTS ? It's just
because it pollutes my screen during unit testing...

Thanks
 
T

Thomas B.

Zouplaz said:
Hello, one module defines several CONSTANTS
As it is required from few classes I get
warning: already initialized constant FOO

How can I prevents the redefinition of theses CONSTANTS ? It's just
because it pollutes my screen during unit testing...

Thanks

It's not clear what's your problem. If you do this:

module M;A=8;end
class K;include M;end
class L;include M;end

you get no warning as the constants is not redefined by including the
module. It just becomes accessible as K::A and L::A. I think you should
paste an isolated sample to illustrate your problem.

TPR.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top