Mike
6/5/2007 12:30:00 PM
On Jun 5, 10:26 pm, Robert Klemme <shortcut...@googlemail.com> wrote:
> On 05.06.2007 14:16, 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
>
> > 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?
>
> You don't. Just use String#replace.
>
> Btw, what are you trying to achieve?
>
> Kind regards
>
> robert
I missed that method. Thank you.