From: Thomas Volkmar Worm Date: 2010-04-15T10:40:08+09:00 Subject: Re: Is there a way to make class and object constants in Ruby? Am Wed, 14 Apr 2010 20:00:54 -0500 schrieb Xeno Campanoli: > I am reading up in other areas, and it occurs to me much of the items I > have as class and object variables really should be constants, but > ideally still in the class or object context. Is there a way to do > this? > > xc In class context you could do: class MyClass MYCONSTANT=6 def initialize puts MYCONSTANT end end But I wonder, whether it makes sense at all to have constants at object level. This sounds weird to me. Thomas