2008/5/20, Iaki Baz Castillo <ibc / aliax.net>:
> 2008/5/20, Michael Fellinger <m.fellinger / gmail.com>:
>
> > 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 ---------------------"

-- 
Iaki Baz Castillo
<ibc / aliax.net>