From: Dmitry Bilunov Date: 2007-08-08T20:21:19+09:00 Subject: Re: non-constant strings dohzya wrote: > Hi, > > 2007/8/7, Dmitry Bilunov : >> # Creates an instance. Guaranties, that a command is safe. >> end >> >> >> > You want to freeze the object @command, not the class String, don't > you ? > So you don't need to use an Immutable_String class, just add > @command.freeze in your code It will make impossible changing @command inside instance methods (which can be guaranteed to be safe). If there is a way to unfreeze a frozen object, then this method could be called externally and one can gain write access to an internal instance variable. -- Posted via http://www.ruby-forum.com/.