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/.