From: matz@... (Yukihiro Matsumoto) Date: 2003-03-12T14:36:18+09:00 Subject: Re: How to add a destructive method to the String class... Hi, In message "How to add a destructive method to the String class..." on 03/03/12, Jeremy writes: |all the words in a string, assuming that each word is seperated by a space. |I did this, and it works fine: | |class String | def capwords | self.split.each { |word| word.capitalize! }.join(" ") | end |end | |It does what I need, but it got me thinking. How would I make this |destructive? In other words, rather than having to do an assingment like |this: class String def capwords! self.gsub!(/^[a-z]/) {|x| x.upcase } end end matz.