From: Henrik Date: 2006-01-06T22:07:14+09:00 Subject: How to write a destructive string method? I haven't been able to figure out how to write a destructive string method of my own. How do I change the value of "self"? This is what I tried first: class String alias_method(:orig_upcase, :upcase) def upcase orig_upcase.tr("åäö", "ÅÄÖ") end def upcase! self = self.upcase end end "upcase" works fine but "upcase!" doesn't - "can't change the value of self". Nor can I do (assuming another alias_method): def upcase! self.old_upcase! self.tr!("åäö", "ÅÄÖ") end or the same thing chained (self.old_upcase!.tr!(...)), because that only returns nil. I've even grasped for straws like def upcase! =(self.upcase) end with no luck. Very grateful for any help. -- Posted via http://www.ruby-forum.com/.