M
Mike
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?
Thanks.
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?
Thanks.