From: Dan Fitzpatrick Date: 2005-06-02T01:29:37+09:00 Subject: Re: Method Chaining Issues aartist wrote: > try this: > string = "I am sold" > string.sub!('old','new').reverse!; > puts string > > It works. > > If string didn't contain the word 'old' then it will fail. > Is that a nice behavior? > Can it be changed to work on whatever input? > > You can remove the nil case like this: (string.sub!('x','new') || string).reverse! Dan