From: Robert Dober Date: 2007-06-05T21:30:13+09:00 Subject: Re: Writing method "change!" for String On 6/5/07, Mike wrote: > Hi, > > I'm trying to write simple method to change internal value of > String class: > > class String > def change! > self="0" if self.downcase=="myvalue1" > self="1" if self.downcase=="myvalue2" > self > end > end > class String def change! case downcase when "myvalue" replace("0") etc. etc. > test="myvalue1" > test.change! > p test > > It should just change value of string to what I want. But I get error: > "Can't change the value of self". > How do I proceed? > HTH Robert -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw