@inteloide said:
Now, the problem is that @@var must be define in B.rb : what about if I need to create a third file which require @@var ? I must declare again the same variable !
NO.. the @@var is a module variable. It is SHARED by ALL classes and modules that include the mixin module M::I
If you change @@var value from an instance of class M::A, all other instances will see the change. Also any modules that included the M::I mixin will share the @@var. (It is a proxy lookup INTO the mixin library module M::I.)
Files are NOT included (that is a Python feature.) IN Ruby modules are included. A file can define multiple modules.
@inteloide said:
Any solution ? (Because in my plugins, there are a lot of variables used in a lot of sub-programs...
If you want each class instance or sub-module to use it's OWN variables, the use instance vars, ... @var (only a single @ before the variable name.)
This is all basic Ruby, explained in the "Pick-Axe" Book.