From: "Iñaki Baz Castillo" Date: 2008-05-20T18:41:06+09:00 Subject: Re: Using a @@class_variable into a Module 2008/5/20, Iñaki Baz Castillo : > 2008/5/20, Michael Fellinger : > > > So why not making it a constant? Try to stay away from class > > variables, they are evil. > > > Nice suggestion, but I'm not sure if that wwill be valid since I need > various clases each one with a own constant value and all of then > including a module that uses that constant. I'll try it. Yeah, it works! module M def kk puts self.class::VAR end end class A include M VAR = "--------------------- @@ A ---------------------" end class B include M VAR = "--------------------- @@ B ---------------------" end irb> a=A.new irb> a.kk "--------------------- @@ A ---------------------" irb> b=B.new irb> b.kk "--------------------- @@ BA ---------------------" irb> a.kk "--------------------- @@ A ---------------------" -- Iñaki Baz Castillo